|
From: <caw...@us...> - 2007-04-20 22:48:33
|
Revision: 2351
http://svn.sourceforge.net/rubyeclipse/?rev=2351&view=rev
Author: cawilliams
Date: 2007-04-20 15:48:30 -0700 (Fri, 20 Apr 2007)
Log Message:
-----------
allow users to edit load paths of ruby projects, also begin quick fix processor infrastructure
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/META-INF/MANIFEST.MF
trunk/org.rubypeople.rdt.ui/plugin.properties
trunk/org.rubypeople.rdt.ui/plugin.xml
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/RubyModelUtil.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/IUIConstants.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyPluginImages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/browsing/RubyBrowsingPerspectiveFactory.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/AbstractConfigurationBlock.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.properties
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditorMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditorMessages.properties
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/HTMLPrinter.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/correction/CorrectionMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover/AbstractRubyEditorTextHover.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewWizardMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewWizardMessages.properties
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/ISharedImages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/PreferenceConstants.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.ui/icons/full/obj16/cp_order_obj.gif
trunk/org.rubypeople.rdt.ui/icons/full/obj16/jar_lsrc_obj.gif
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/buildpath/
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/BusyIndicatorRunnableContext.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/filters/LibraryFilter.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/BuildPathsPropertyPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/NewRubyProjectPreferencePage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/correction/CUCorrectionProposal.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/util/SelectionUtil.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/util/ViewerPane.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/viewsupport/ImageDisposer.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/LoadPathDetector.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/OpenNewRubyProjectWizardAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/OpenRubyProjectWizardToolbarAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/RubyProjectWizard.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/RubyProjectWizardFirstPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/RubyProjectWizardSecondPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/AddFolderToBuildpathAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/AddLibraryToBuildpathAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/AddSelectedLibraryToBuildpathAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/ConfigureBuildPathAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/DialogPackageExplorer.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/DialogPackageExplorerActionGroup.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/ExcludeFromBuildpathAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/GenerateBuildPathActionGroup.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/HelpAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/HintTextGroup.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/IncludeToBuildpathAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/LinkFolderDialog.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/LoadpathModifierAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/LoadpathModifierDropDownAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/LoadpathModifierOperation.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/LoadpathModifierQueries.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/NewSourceContainerWorkbookPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/RemoveFromBuildpathAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/newsourcepage/RemoveLinkedFolderDialog.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/dialogfields/CheckedListDialogField.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/dialogfields/ITreeListAdapter.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/dialogfields/TreeListDialogField.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/workingsets/
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/AbstractOpenWizardAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/search/
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/search/ElementQuerySpecification.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/search/IMatchPresentation.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/search/IQueryParticipant.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/search/ISearchRequestor.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/search/PatternQuerySpecification.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/search/QuerySpecification.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/BuildPathDialogAccess.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/ILoadpathContainerPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/ILoadpathContainerPageExtension.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/ILoadpathContainerPageExtension2.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/RubyCapabilityConfigurationPage.java
Removed Paths:
-------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/OpenProjectWizardAction.java
Modified: trunk/org.rubypeople.rdt.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/org.rubypeople.rdt.ui/META-INF/MANIFEST.MF 2007-04-20 22:12:26 UTC (rev 2350)
+++ trunk/org.rubypeople.rdt.ui/META-INF/MANIFEST.MF 2007-04-20 22:48:30 UTC (rev 2351)
@@ -56,6 +56,7 @@
org.eclipse.search,
org.jruby,
org.eclipse.compare,
+ org.eclipse.core.filesystem,
org.eclipse.core.expressions,
org.eclipse.ltk.core.refactoring
Eclipse-LazyStart: true
Added: trunk/org.rubypeople.rdt.ui/icons/full/obj16/cp_order_obj.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/obj16/cp_order_obj.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.ui/icons/full/obj16/jar_lsrc_obj.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/obj16/jar_lsrc_obj.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/org.rubypeople.rdt.ui/plugin.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.properties 2007-04-20 22:12:26 UTC (rev 2350)
+++ trunk/org.rubypeople.rdt.ui/plugin.properties 2007-04-20 22:48:30 UTC (rev 2351)
@@ -55,6 +55,7 @@
preferenceKeywords.folding=Ruby editor folding section comment comments header method import inner type
preferenceKeywords.markoccurrences=Ruby editor occurrence mark highlight type method constant field exception
+buildPathPageName=Ruby Load Path
PerspectiveRuby.name=Ruby
ViewRubyResources.name=Ruby Resources
Modified: trunk/org.rubypeople.rdt.ui/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.xml 2007-04-20 22:12:26 UTC (rev 2350)
+++ trunk/org.rubypeople.rdt.ui/plugin.xml 2007-04-20 22:48:30 UTC (rev 2351)
@@ -7,7 +7,7 @@
<extension-point id="foldingStructureProviders" name="%foldingStructureProviders" schema="schema/foldingStructureProviders.exsd"/>
<extension-point id="editorPopupExtender" name="%editorPopupExtender" schema="schema/org.rubypeople.rdt.ui.editorPopupExtender.exsd"/>
<extension-point id="rubyTemplateProvider" name="Ruby template provider" schema="schema/rubyTemplateProvider.exsd"/>
- <extension-point id="quickFixProcessors" name="%quickFixProcessorExtensionPoint" schema="schema/quickFixProcessors.exsd"/>
+ <extension-point id="quickFixProcessors" name="%quickFixProcessorExtensionPoint" schema="schema/quickFixProcessors.exsd"/>
<extension
point="org.eclipse.ui.preferencePages">
@@ -245,11 +245,11 @@
name="%NewWizardRubyProject.name"
icon="icons/full/etool16/newrprj_wiz.gif"
category="org.rubypeople.rdt.ui"
- class="org.rubypeople.rdt.internal.ui.wizards.NewProjectCreationWizard"
+ class="org.rubypeople.rdt.internal.ui.wizards.RubyProjectWizard"
preferredPerspectives="org.rubypeople.rdt.ui.PerspectiveRuby"
project="true"
finalPerspective="org.rubypeople.rdt.ui.PerspectiveRuby"
- id="org.rubypeople.rdt.ui.wizards.NewWizardProjectCreation">
+ id="org.rubypeople.rdt.ui.wizards.RubyProjectWizard">
<description>
Create a new Ruby project.
</description>
@@ -298,6 +298,28 @@
</enabledWhen>
<keywordReference id="org.rubypeople.rdt.ui.severities"/>
</page>
+ <page
+ objectClass="org.eclipse.core.resources.IProject"
+ name="%buildPathPageName"
+ class="org.rubypeople.rdt.internal.ui.preferences.BuildPathsPropertyPage"
+ id="org.rubypeople.rdt.ui.propertyPages.BuildPathsPropertyPage">
+ <filter
+ name="nature"
+ value="org.rubypeople.rdt.core.rubynature">
+ </filter>
+ <keywordReference id="org.rubypeople.rdt.ui.buildpath"/>
+ </page>
+ <page
+ objectClass="org.rubypeople.rdt.core.IRubyProject"
+ name="%buildPathPageName"
+ class="org.rubypeople.rdt.internal.ui.preferences.BuildPathsPropertyPage"
+ id="org.rubypeople.rdt.ui.propertyPages.BuildPathsPropertyPage">
+ <filter
+ name="nature"
+ value="org.rubypeople.rdt.core.rubynature">
+ </filter>
+ <keywordReference id="org.rubypeople.rdt.ui.buildpath"/>
+ </page>
</extension>
<extension
@@ -652,7 +674,7 @@
label="%OpenProjectWizardAction.label"
icon="icons/full/etool16/newrprj_wiz.gif"
tooltip="%OpenProjectWizardAction.tooltip"
- class="org.rubypeople.rdt.internal.ui.wizards.OpenProjectWizardAction"
+ class="org.rubypeople.rdt.internal.ui.wizards.OpenRubyProjectWizardToolbarAction"
toolbarPath="Normal/RubyWizards"
id="org.rubypeople.rdt.ui.actions.OpenProjectWizard">
</action>
@@ -975,6 +997,5 @@
<hyperlinkProvider
class="org.rubypeople.rdt.internal.ui.text.hyperlinks.RubyElementsHyperlinkProvider">
</hyperlinkProvider>
- </extension>
-
+ </extension>
</plugin>
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/BusyIndicatorRunnableContext.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/BusyIndicatorRunnableContext.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/BusyIndicatorRunnableContext.java 2007-04-20 22:48:30 UTC (rev 2351)
@@ -0,0 +1,142 @@
+/**
+ * Copyright (c) 2007 Aptana, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl -v10.html. If redistributing this code,
+ * this entire header must remain intact.
+ *
+ * This file is based on a JDT equivalent:
+ ********************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.internal.corext.util;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.operation.ModalContext;
+import org.eclipse.swt.custom.BusyIndicator;
+
+/**
+ * A runnable context that shows the busy cursor instead of a progress
+ * monitor. Note, that the UI thread is blocked even if the runnable
+ * is executed in a separate thread by passing <code>fork= true</code>
+ * to the context's run method. Furthermore this context doesn't provide
+ * any UI to cancel the operation.
+ */
+public class BusyIndicatorRunnableContext implements IRunnableContext {
+
+ private static class BusyRunnable implements Runnable {
+
+ private static class ThreadContext extends Thread {
+ IRunnableWithProgress fRunnable;
+ Throwable fThrowable;
+
+ public ThreadContext(IRunnableWithProgress runnable) {
+ this(runnable, "BusyCursorRunnableContext-Thread"); //$NON-NLS-1$
+ }
+ protected ThreadContext(IRunnableWithProgress runnable, String name) {
+ super(name);
+ fRunnable= runnable;
+ }
+ public void run() {
+ try {
+ fRunnable.run(new NullProgressMonitor());
+ } catch (InvocationTargetException e) {
+ fThrowable= e;
+ } catch (InterruptedException e) {
+ fThrowable= e;
+ } catch (ThreadDeath e) {
+ fThrowable= e;
+ throw e;
+ } catch (RuntimeException e) {
+ fThrowable= e;
+ } catch (Error e) {
+ fThrowable= e;
+ }
+ }
+ void sync() {
+ try {
+ join();
+ } catch (InterruptedException e) {
+ // ok to ignore exception
+ }
+ }
+ }
+
+ public Throwable fThrowable;
+ private boolean fFork;
+ private IRunnableWithProgress fRunnable;
+ public BusyRunnable(boolean fork, IRunnableWithProgress runnable) {
+ fFork= fork;
+ fRunnable= runnable;
+ }
+ public void run() {
+ try {
+ internalRun(fFork, fRunnable);
+ } catch (InvocationTargetException e) {
+ fThrowable= e;
+ } catch (InterruptedException e) {
+ fThrowable= e;
+ }
+ }
+ private void internalRun(boolean fork, final IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
+ Thread thread= Thread.currentThread();
+ // Do not spawn another thread if we are already in a modal context
+ // thread or inside a busy context thread.
+ if (thread instanceof ThreadContext || ModalContext.isModalContextThread(thread))
+ fork= false;
+
+ if (fork) {
+ final ThreadContext t= new ThreadContext(runnable);
+ t.start();
+ t.sync();
+ // Check if the separate thread was terminated by an exception
+ Throwable throwable= t.fThrowable;
+ if (throwable != null) {
+ if (throwable instanceof InvocationTargetException) {
+ throw (InvocationTargetException) throwable;
+ } else if (throwable instanceof InterruptedException) {
+ throw (InterruptedException) throwable;
+ } else if (throwable instanceof OperationCanceledException) {
+ throw new InterruptedException();
+ } else {
+ throw new InvocationTargetException(throwable);
+ }
+ }
+ } else {
+ try {
+ runnable.run(new NullProgressMonitor());
+ } catch (OperationCanceledException e) {
+ throw new InterruptedException();
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * Method declared on IRunnableContext.
+ */
+ public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
+ BusyRunnable busyRunnable= new BusyRunnable(fork, runnable);
+ BusyIndicator.showWhile(null, busyRunnable);
+ Throwable throwable= busyRunnable.fThrowable;
+ if (throwable instanceof InvocationTargetException) {
+ throw (InvocationTargetException)throwable;
+ } else if (throwable instanceof InterruptedException) {
+ throw (InterruptedException)throwable;
+ }
+ }
+}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/RubyModelUtil.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/RubyModelUtil.java 2007-04-20 22:12:26 UTC (rev 2350)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/RubyModelUtil.java 2007-04-20 22:48:30 UTC (rev 2351)
@@ -3,10 +3,12 @@
*/
package org.rubypeople.rdt.internal.corext.util;
+import org.eclipse.core.runtime.IPath;
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.IRubyScript;
import org.rubypeople.rdt.core.ISourceFolderRoot;
import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.core.util.CharOperation;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
/**
@@ -69,4 +71,15 @@
public static ISourceFolderRoot getSourceFolderRoot(IRubyElement element) {
return (ISourceFolderRoot) element.getAncestor(IRubyElement.SOURCE_FOLDER_ROOT);
}
+
+ public static boolean isExcludedPath(IPath resourcePath, IPath[] exclusionPatterns) {
+ char[] path = resourcePath.toString().toCharArray();
+ for (int i = 0, length = exclusionPatterns.length; i < length; i++) {
+ char[] pattern= exclusionPatterns[i].toString().toCharArray();
+ if (CharOperation.pathMatch(pattern, path, true, '/')) {
+ return true;
+ }
+ }
+ return false;
+ }
}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/IUIConstants.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/IUIConstants.java 2007-04-20 22:12:26 UTC (rev 2350)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/IUIConstants.java 2007-04-20 22:48:30 UTC (rev 2351)
@@ -4,4 +4,5 @@
public interface IUIConstants {
public static final String DIALOGSTORE_TYPECOMMENT_DEPRECATED= RubyUI.ID_PLUGIN + ".typecomment.deprecated"; //$NON-NLS-1$
+ public static final String DIALOGSTORE_LASTEXTJAR= RubyUI.ID_PLUGIN + ".lastextjar"; //$NON-NLS-1$
}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyPluginImages.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyPluginImages.java 2007-04-20 22:12:26 UTC (rev 2350)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyPluginImages.java 2007-04-20 22:48:30 UTC (rev 2351)
@@ -30,19 +30,20 @@
private static final String T_DLCL= "dlcl16"; //$NON-NLS-1$
private static final String T_CTOOL = "ctool16"; //$NON-NLS-1$
private static final String T_WIZBAN= "wizban"; //$NON-NLS-1$
-
+ private static final String T_ETOOL= "etool16"; //$NON-NLS-1$
+
/*
* Keys for images available from the Ruby-UI plug-in image registry.
*/
public static final String IMG_MISC_PUBLIC= NAME_PREFIX + "methpub_obj.gif"; //$NON-NLS-1$
public static final String IMG_MISC_PROTECTED= NAME_PREFIX + "methpro_obj.gif"; //$NON-NLS-1$
public static final String IMG_MISC_PRIVATE= NAME_PREFIX + "methpri_obj.gif"; //$NON-NLS-1$
-
public static final String IMG_OBJS_ERROR = NAME_PREFIX + "error_obj.gif";
public static final String IMG_OBJS_WARNING = NAME_PREFIX + "warning_obj.gif";
public static final String IMG_OBJS_INFO = NAME_PREFIX + "info_obj.gif";
public static final String IMG_OBJS_HELP= NAME_PREFIX + "help.gif"; //$NON-NLS-1$
private static final String IMG_OBJS_GHOST= NAME_PREFIX + "ghost.gif"; //$NON-NLS-1$
+
private static final String IMG_OBJS_CLASS= NAME_PREFIX + "class_obj.gif"; //$NON-NLS-1$
private static final String IMG_OBJS_INNER_CLASS= NAME_PREFIX + "innerclass_obj.gif"; //$NON-NLS-1$
private static final String IMG_OBJS_CLASSALT= NAME_PREFIX + "classfo_obj.gif"; //$NON-NLS-1$
@@ -50,12 +51,14 @@
private static final String IMG_OBJS_MODULEALT= NAME_PREFIX + "modulefo_obj.gif"; //$NON-NLS-1$
private static final String IMG_OBJS_RUBY_MODEL= NAME_PREFIX + "ruby_model_obj.gif"; //$NON-NLS-1$
private static final String IMG_OBJS_SOURCE_FOLDER= NAME_PREFIX + "fldr_obj.gif"; //$NON-NLS-1$
- private static final String IMG_OBJS_SOURCE_FOLDER_ROOT= NAME_PREFIX + "fldr_root_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_SOURCE_FOLDER_ROOT= NAME_PREFIX + "fldr_root_obj.gif"; //$NON-NLS-1$
private static final String IMG_OBJS_SCRIPT= NAME_PREFIX + "rscript_obj.gif"; //$NON-NLS-1$
private static final String IMG_OBJS_RUBY_RESOURCE= NAME_PREFIX + "rscript_resource_obj.gif"; //$NON-NLS-1$
private static final String IMG_OBJS_UNKNOWN= NAME_PREFIX + "unknown_obj.gif"; //$NON-NLS-1$
-
+ public static final String IMG_OBJS_ENV_VAR= NAME_PREFIX + "envvar_obj.gif"; //$NON-NLS-1$
public static final String IMG_OBJS_LIBRARY= NAME_PREFIX + "library_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_EXTJAR= NAME_PREFIX + "jar_l_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_EXTJAR_WSRC= NAME_PREFIX + "jar_lsrc_obj.gif"; //$NON-NLS-1$
private static final String IMG_CTOOLS_RUBY_IMPORT_CONTAINER = NAME_PREFIX + "imp_c.gif";
private static final String IMG_CTOOLS_RUBY_IMPORT = NAME_PREFIX + "imp_obj.gif";
@@ -80,14 +83,23 @@
public static final ImageDescriptor DESC_WIZBAN_NEWJPRJ = createUnManaged(T_WIZBAN, "newrprj_wiz.gif"); //$NON-NLS-1$
public static final ImageDescriptor DESC_WIZBAN_NEWCLASS = createUnManaged(T_WIZBAN, "newclass_wiz.gif"); //$NON-NLS-1$
-
- // RI
- public static final ImageDescriptor TOOLBAR_REFRESH = createUnManaged(T_ELCL, "refresh.png");
+ public static final ImageDescriptor DESC_WIZBAN_NEWSRCFOLDR= createUnManaged(T_WIZBAN, "newsrcfldr_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_ADD_LIBRARY= createUnManaged(T_WIZBAN, "addlibrary_wiz.png");//$NON-NLS-1$
+ public static final ImageDescriptor TOOLBAR_REFRESH = createUnManaged(T_ELCL, "refresh.png");
+
+ public static final ImageDescriptor DESC_OBJS_HELP= createManagedFromKey(T_ELCL, IMG_OBJS_HELP);
+
public static final ImageDescriptor DESC_OBJ_OVERRIDES= createUnManaged(T_OBJ, "over_co.gif"); //$NON-NLS-1$
public static final ImageDescriptor DESC_OBJ_IMPLEMENTS= createUnManaged(T_OBJ, "implm_co.gif"); //$NON-NLS-1$
public static final ImageDescriptor DESC_OBJS_LIBRARY= createManagedFromKey(T_OBJ, IMG_OBJS_LIBRARY);
-
+ public static final ImageDescriptor DESC_OBJS_EXTJAR= createManagedFromKey(T_OBJ, IMG_OBJS_EXTJAR);
+ public static final ImageDescriptor DESC_OBJS_EXTJAR_WSRC= createManagedFromKey(T_OBJ, IMG_OBJS_EXTJAR_WSRC);
+ public static final ImageDescriptor DESC_OBJS_ENV_VAR= createManagedFromKey(T_OBJ, IMG_OBJS_ENV_VAR);
+
+ public static final ImageDescriptor DESC_OBJS_EXCLUSION_FILTER_ATTRIB= createUnManaged(T_OBJ, "exclusion_filter_attrib.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OBJS_INCLUSION_FILTER_ATTRIB= createUnManaged(T_OBJ, "inclusion_filter_attrib.gif"); //$NON-NLS-1$
+
public static final ImageDescriptor DESC_OVR_STATIC= createUnManaged(T_OVR, "static_co.gif"); //$NON-NLS-1$
public static final ImageDescriptor DESC_OVR_FINAL= createUnManaged(T_OVR, "final_co.gif"); //$NON-NLS-1$
public static final ImageDescriptor DESC_OVR_ABSTRACT= createUnManaged(T_OVR, "abstract_co.gif"); //$NON-NLS-1$
@@ -102,9 +114,6 @@
public static final ImageDescriptor DESC_OVR_CONSTRUCTOR= createUnManaged(T_OVR, "constr_ovr.gif"); //$NON-NLS-1$
public static final ImageDescriptor DESC_OVR_DEPRECATED= createUnManaged(T_OVR, "deprecated.gif");
- public static final ImageDescriptor DESC_ELCL_FILTER= createUnManaged(T_ELCL, "filter_ps.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_DLCL_FILTER= createUnManaged(T_DLCL, "filter_ps.gif"); //$NON-NLS-1$
-
public static final ImageDescriptor DESC_OBJS_GHOST= createManagedFromKey(T_OBJ, IMG_OBJS_GHOST);
public static final ImageDescriptor DESC_OBJS_IMPDECL= createManagedFromKey(T_OBJ, IMG_CTOOLS_RUBY_IMPORT);
public static final ImageDescriptor DESC_OBJS_IMPCONT= createManagedFromKey(T_OBJ, IMG_CTOOLS_RUBY_IMPORT_CONTAINER);
@@ -122,18 +131,47 @@
public static final ImageDescriptor DESC_OBJS_CLASS= createManagedFromKey(T_OBJ, IMG_OBJS_CLASS);
public static final ImageDescriptor DESC_OBJS_CLASSALT= createManagedFromKey(T_OBJ, IMG_OBJS_CLASSALT);
public static final ImageDescriptor DESC_OBJS_INNER_CLASS= createManagedFromKey(T_OBJ, IMG_OBJS_INNER_CLASS);
- public static final ImageDescriptor DESC_OBJS_MODULEALT = createManagedFromKey(T_OBJ, IMG_OBJS_MODULEALT);
-
-
+ public static final ImageDescriptor DESC_OBJS_MODULEALT = createManagedFromKey(T_OBJ, IMG_OBJS_MODULEALT);
public static final ImageDescriptor DESC_OBJS_SCRIPT= createManagedFromKey(T_OBJ, IMG_OBJS_SCRIPT);
public static final ImageDescriptor DESC_OBJS_RUBY_RESOURCE= createManagedFromKey(T_OBJ, IMG_OBJS_RUBY_RESOURCE);
+ public static final ImageDescriptor DESC_OBJS_UNKNOWN= createManagedFromKey(T_OBJ, IMG_OBJS_UNKNOWN);
+ public static final ImageDescriptor DESC_TOOL_NEWPACKROOT= createUnManaged(T_ETOOL, "newpackfolder_wiz.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_ELCL_FILTER= createUnManaged(T_ELCL, "filter_ps.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_DLCL_FILTER= createUnManaged(T_DLCL, "filter_ps.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_ELCL_REMOVE_FROM_BP= createUnManaged(T_ELCL, "remove_from_buildpath.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_DLCL_ADD_AS_SOURCE_FOLDER= createUnManaged(T_DLCL, "add_as_source_folder.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_ADD_AS_SOURCE_FOLDER= createUnManaged(T_ELCL, "add_as_source_folder.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_DLCL_REMOVE_AS_SOURCE_FOLDER= createUnManaged(T_DLCL, "remove_as_source_folder.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_REMOVE_AS_SOURCE_FOLDER= createUnManaged(T_ELCL, "remove_as_source_folder.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_DLCL_EXCLUDE_FROM_BUILDPATH= createUnManaged(T_DLCL, "exclude_from_buildpath.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_EXCLUDE_FROM_BUILDPATH= createUnManaged(T_ELCL, "exclude_from_buildpath.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_DLCL_INCLUDE_ON_BUILDPATH= createUnManaged(T_DLCL, "include_on_buildpath.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_INCLUDE_ON_BUILDPATH= createUnManaged(T_ELCL, "include_on_buildpath.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_DLCL_CONFIGURE_BUILDPATH_FILTERS= createUnManaged(T_DLCL, "configure_buildpath_filters.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_CONFIGURE_BUILDPATH_FILTERS= createUnManaged(T_ELCL, "configure_buildpath_filters.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_DLCL_ADD_LINKED_SOURCE_TO_BUILDPATH= createUnManaged(T_DLCL, "add_linked_source_to_buildpath.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_ADD_LINKED_SOURCE_TO_BUILDPATH= createUnManaged(T_ELCL, "add_linked_source_to_buildpath.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_ELCL_CLEAR= createUnManaged(T_ELCL, "clear_co.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_DLCL_CLEAR= createUnManaged(T_DLCL, "clear_co.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_DLCL_CONFIGURE_BUILDPATH= createUnManaged(T_DLCL, "configure_build_path.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_CONFIGURE_BUILDPATH= createUnManaged(T_ELCL, "configure_build_path.gif"); //$NON-NLS-1$
+
public static final ImageDescriptor DESC_MISC_PUBLIC= createManagedFromKey(T_OBJ, IMG_MISC_PUBLIC);
public static final ImageDescriptor DESC_MISC_PROTECTED= createManagedFromKey(T_OBJ, IMG_MISC_PROTECTED);
public static final ImageDescriptor DESC_MISC_PRIVATE= createManagedFromKey(T_OBJ, IMG_MISC_PRIVATE);
-
- public static final ImageDescriptor DESC_OBJS_UNKNOWN= createManagedFromKey(T_OBJ, IMG_OBJS_UNKNOWN);
public static final String IMG_CORRECTION_CHANGE= NAME_PREFIX + "correction_change.gif"; //$NON-NLS-1$
+ public static final ImageDescriptor DESC_TOOL_LOADPATH_ORDER= createUnManaged(T_OBJ, "cp_order_obj.gif"); //$NON-NLS-1$
static {
createManagedFromKey(T_OBJ, IMG_CORRECTION_CHANGE);
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.java 2007-04-20 22:12:26 UTC (rev 2350)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.java 2007-04-20 22:48:30 UTC (rev 2351)
@@ -51,6 +51,14 @@
public static String OpenTypeAction_error_title;
public static String OpenTypeAction_error_messageProblems;
public static String OpenTypeAction_message;
+ public static String OpenNewSourceFolderWizardAction_text2;
+ public static String OpenNewSourceFolderWizardAction_description;
+ public static String OpenNewSourceFolderWizardAction_tooltip;
+ public static String BuildPath_label;
+
+ public static String OpenNewRubyProjectWizardAction_text;
+ public static String OpenNewRubyProjectWizardAction_description;
+ public static String OpenNewRubyProjectWizardAction_tooltip;
static {
NLS.initializeMessages(BUNDLE_NAME, ActionMessages.class);
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/browsing/RubyBrowsingPerspectiveFactory.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/browsing/RubyBrowsingPerspectiveFactory.java 2007-04-20 22:12:26 UTC (rev 2350)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/browsing/RubyBrowsingPerspectiveFactory.java 2007-04-20 22:48:30 UTC (rev 2351)
@@ -68,7 +68,7 @@
layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
// new actions - Ruby project creation wizard
- layout.addNewWizardShortcut("org.rubypeople.rdt.ui.wizards.NewProjectCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.rubypeople.rdt.ui.wizards.RubyProjectWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.rubypeople.rdt.ui.wizards.NewClassCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/filters/LibraryFilter.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/filters/LibraryFilter.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/filters/LibraryFilter.java 2007-04-20 22:48:30 UTC (rev 2351)
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2007 Aptana, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl -v10.html. If redistributing this code,
+ * this entire header must remain intact.
+ *
+ * This file is based on a JDT equivalent:
+ ********************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.internal.ui.filters;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.rubypeople.rdt.core.ISourceFolderRoot;
+import org.rubypeople.rdt.internal.ui.packageview.LoadPathContainer;
+
+
+/**
+ * The LibraryFilter is a filter used to determine whether
+ * a Java library is shown
+ */
+public class LibraryFilter extends ViewerFilter {
+
+ /* (non-Javadoc)
+ * Method declared on ViewerFilter.
+ */
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (element instanceof LoadPathContainer)
+ return false;
+ if (element instanceof ISourceFolderRoot) {
+ ISourceFolderRoot root= (ISourceFolderRoot)element;
+ if (root.isArchive()) {
+ // don't filter out JARs contained in the project itself
+ IResource resource= root.getResource();
+ if (resource != null) {
+ IProject jarProject= resource.getProject();
+ IProject container= root.getRubyProject().getProject();
+ return container.equals(jarProject);
+ }
+ return false;
+ }
+ }
+ return true;
+ }
+}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/AbstractConfigurationBlock.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/AbstractConfigurationBlock.java 2007-04-20 22:12:26 UTC (rev 2350)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/AbstractConfigurationBlock.java 2007-04-20 22:48:30 UTC (rev 2351)
@@ -45,11 +45,11 @@
import org.rubypeople.rdt.internal.ui.util.PixelConverter;
/**
- * Configures Java Editor typing preferences.
+ * Configures Ruby Editor typing preferences.
*
* @since 3.1
*/
-abstract class AbstractConfigurationBlock implements IPreferenceConfigurationBlock {
+public abstract class AbstractConfigurationBlock implements IPreferenceConfigurationBlock {
/**
* Use as follows:
@@ -320,7 +320,10 @@
* @return the controls added
*/
protected Control[] addLabelledTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
-
+ return addLabelledTextField(composite, label, key, textLimit, indentation, isNumber, SWT.BORDER | SWT.SINGLE, 1, textLimit);
+ }
+
+ protected Control[] addLabelledTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber, int textStyle, int height, int width) {
PixelConverter pixelConverter= new PixelConverter(composite);
Label labelControl= new Label(composite, SWT.NONE);
@@ -329,11 +332,12 @@
gd.horizontalIndent= indentation;
labelControl.setLayoutData(gd);
- Text textControl= new Text(composite, SWT.BORDER | SWT.SINGLE);
+ Text textControl= new Text(composite, textStyle);
gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.widthHint= pixelConverter.convertWidthInCharsToPixels(textLimit + 1);
+ gd.widthHint= pixelConverter.convertWidthInCharsToPixels(width + 1);
textControl.setLayoutData(gd);
textControl.setTextLimit(textLimit);
+ gd.heightHint = pixelConverter.convertHeightInCharsToPixels(height);
fTextFields.put(textControl, key);
if (isNumber) {
fNumberFields.add(textControl);
@@ -344,7 +348,7 @@
return new Control[]{labelControl, textControl};
}
-
+
protected void createDependency(final Button master, final Control slave) {
createDependency(master, new Control[] {slave});
}
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/BuildPathsPropertyPage.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/BuildPathsPropertyPage.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/BuildPathsPropertyPage.java 2007-04-20 22:48:30 UTC (rev 2351)
@@ -0,0 +1,270 @@
+/**
+ * Copyright (c) 2007 Aptana, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl -v10.html. If redistributing this code,
+ * this entire header must remain intact.
+ *
+ * This file is based on a JDT equivalent:
+ ********************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.internal.ui.preferences;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.preference.IPreferencePageContainer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.dialogs.PropertyPage;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+import org.rubypeople.rdt.core.ILoadpathEntry;
+import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.internal.corext.util.BusyIndicatorRunnableContext;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.actions.WorkbenchRunnableAdapter;
+import org.rubypeople.rdt.internal.ui.dialogs.StatusUtil;
+import org.rubypeople.rdt.internal.ui.util.ExceptionHandler;
+import org.rubypeople.rdt.internal.ui.wizards.IStatusChangeListener;
+import org.rubypeople.rdt.internal.ui.wizards.buildpaths.BuildPathsBlock;
+
+/**
+ * Property page for configuring the Ruby build path
+ */
+public class BuildPathsPropertyPage extends PropertyPage implements IStatusChangeListener {
+
+ public static final String PROP_ID= "org.rubypeople.rdt.ui.propertyPages.BuildPathsPropertyPage"; //$NON-NLS-1$
+
+ private static final String PAGE_SETTINGS= "BuildPathsPropertyPage"; //$NON-NLS-1$
+ private static final String INDEX= "pageIndex"; //$NON-NLS-1$
+
+ public static final Object DATA_ADD_ENTRY= "add_classpath_entry"; //$NON-NLS-1$
+
+ public static final Object DATA_REVEAL_ENTRY= "select_classpath_entry"; //$NON-NLS-1$
+ public static final Object DATA_REVEAL_ATTRIBUTE_KEY= "select_classpath_attribute_key"; //$NON-NLS-1$
+
+ public static final Object DATA_BLOCK= "block_until_buildpath_applied"; //$NON-NLS-1$
+
+ private BuildPathsBlock fBuildPathsBlock;
+ private boolean fBlockOnApply= false;
+
+ /*
+ * @see PreferencePage#createControl(Composite)
+ */
+ protected Control createContents(Composite parent) {
+ // ensure the page has no special buttons
+ noDefaultAndApplyButton();
+
+ IProject project= getProject();
+ Control result;
+ if (project == null || !isRubyProject(project)) {
+ result= createWithoutRuby(parent);
+ } else if (!project.isOpen()) {
+ result= createForClosedProject(parent);
+ } else {
+ result= createWithRuby(parent, project);
+ }
+ Dialog.applyDialogFont(result);
+ return result;
+ }
+
+ /*
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+// PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IRubyHelpContextIds.BUILD_PATH_PROPERTY_PAGE);
+ }
+
+ private IDialogSettings getSettings() {
+ IDialogSettings javaSettings= RubyPlugin.getDefault().getDialogSettings();
+ IDialogSettings pageSettings= javaSettings.getSection(PAGE_SETTINGS);
+ if (pageSettings == null) {
+ pageSettings= javaSettings.addNewSection(PAGE_SETTINGS);
+ pageSettings.put(INDEX, 3);
+ }
+ return pageSettings;
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean)
+ */
+ public void setVisible(boolean visible) {
+ if (fBuildPathsBlock != null) {
+ if (!visible) {
+ if (fBuildPathsBlock.hasChangesInDialog()) {
+ String title= PreferencesMessages.BuildPathsPropertyPage_unsavedchanges_title;
+ String message= PreferencesMessages.BuildPathsPropertyPage_unsavedchanges_message;
+ String[] buttonLabels= new String[] {
+ PreferencesMessages.BuildPathsPropertyPage_unsavedchanges_button_save,
+ PreferencesMessages.BuildPathsPropertyPage_unsavedchanges_button_discard,
+ PreferencesMessages.BuildPathsPropertyPage_unsavedchanges_button_ignore
+ };
+ MessageDialog dialog= new MessageDialog(getShell(), title, null, message, MessageDialog.QUESTION, buttonLabels, 0);
+ int res= dialog.open();
+ if (res == 0) {
+ performOk();
+ } else if (res == 1) {
+ fBuildPathsBlock.init(RubyCore.create(getProject()), null, null);
+ } else {
+ // keep unsaved
+ }
+ }
+ } else {
+ if (!fBuildPathsBlock.hasChangesInDialog() && fBuildPathsBlock.hasChangesInLoadpathFile()) {
+ fBuildPathsBlock.init(RubyCore.create(getProject()), null, null);
+ }
+ }
+ }
+ super.setVisible(visible);
+ }
+
+
+ /*
+ * Content for valid projects.
+ */
+ private Control createWithRuby(Composite parent, IProject project) {
+ IWorkbenchPreferenceContainer pageContainer= null;
+ IPreferencePageContainer container= getContainer();
+ if (container instanceof IWorkbenchPreferenceContainer) {
+ pageContainer= (IWorkbenchPreferenceContainer) container;
+ }
+
+ fBuildPathsBlock= new BuildPathsBlock(new BusyIndicatorRunnableContext(), this, getSettings().getInt(INDEX), false, pageContainer);
+ fBuildPathsBlock.init(RubyCore.create(project), null, null);
+ return fBuildPathsBlock.createControl(parent);
+ }
+
+ /*
+ * Content for non-Ruby projects.
+ */
+ private Control createWithoutRuby(Composite parent) {
+ Label label= new Label(parent, SWT.LEFT);
+ label.setText(PreferencesMessages.BuildPathsPropertyPage_no_java_project_message);
+
+ fBuildPathsBlock= null;
+ setValid(true);
+ return label;
+ }
+
+ /*
+ * Content for closed projects.
+ */
+ private Control createForClosedProject(Composite parent) {
+ Label label= new Label(parent, SWT.LEFT);
+ label.setText(PreferencesMessages.BuildPathsPropertyPage_closed_project_message);
+
+ fBuildPathsBlock= null;
+ setValid(true);
+ return label;
+ }
+
+ private IProject getProject() {
+ IAdaptable adaptable= getElement();
+ if (adaptable != null) {
+ IRubyElement elem= (IRubyElement) adaptable.getAdapter(IRubyElement.class);
+ if (elem instanceof IRubyProject) {
+ return ((IRubyProject) elem).getProject();
+ }
+ }
+ return null;
+ }
+
+ private boolean isRubyProject(IProject proj) {
+ try {
+ return proj.hasNature(RubyCore.NATURE_ID);
+ } catch (CoreException e) {
+ RubyPlugin.log(e);
+ }
+ return false;
+ }
+
+ /*
+ * @see IPreferencePage#performOk
+ */
+ public boolean performOk() {
+ if (fBuildPathsBlock != null) {
+ getSettings().put(INDEX, fBuildPathsBlock.getPageIndex());
+ if (fBuildPathsBlock.hasChangesInDialog()) {
+ IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
+ fBuildPathsBlock.configureRubyProject(monitor);
+ }
+ };
+ WorkbenchRunnableAdapter op= new WorkbenchRunnableAdapter(runnable);
+ if (fBlockOnApply) {
+ try {
+ new ProgressMonitorDialog(getShell()).run(true, true, op);
+ } catch (InvocationTargetException e) {
+ ExceptionHandler.handle(e, getShell(), PreferencesMessages.BuildPathsPropertyPage_error_title, PreferencesMessages.BuildPathsPropertyPage_error_message);
+ return false;
+ } catch (InterruptedException e) {
+ return false;
+ }
+ } else {
+ op.runAsUserJob(PreferencesMessages.BuildPathsPropertyPage_job_title, null);
+ }
+ }
+ }
+ return true;
+ }
+
+ /* (non-Rubydoc)
+ * @see IStatusChangeListener#statusChanged
+ */
+ public void statusChanged(IStatus status) {
+ setValid(!status.matches(IStatus.ERROR));
+ StatusUtil.applyToStatusLine(this, status);
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jface.preference.PreferencePage#applyData(java.lang.Object)
+ */
+ public void applyData(Object data) {
+ if (data instanceof Map) {
+ Map map= (Map) data;
+ Object selectedLibrary= map.get(DATA_REVEAL_ENTRY);
+ if (selectedLibrary instanceof ILoadpathEntry) {
+ ILoadpathEntry entry= (ILoadpathEntry) selectedLibrary;
+ Object attr= map.get(DATA_REVEAL_ATTRIBUTE_KEY);
+ String attributeKey= attr instanceof String ? (String) attr : null;
+ if (fBuildPathsBlock != null) {
+ fBuildPathsBlock.setElementToReveal(entry, attributeKey);
+ }
+ }
+ Object entryToAdd= map.get(DATA_ADD_ENTRY);
+ if (entryToAdd instanceof ILoadpathEntry) {
+ if (fBuildPathsBlock != null) {
+ fBuildPathsBlock.addElement((ILoadpathEntry) entryToAdd);
+ }
+ }
+ fBlockOnApply= Boolean.TRUE.equals(map.get(DATA_BLOCK));
+ }
+ }
+
+}
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/NewRubyProjectPreferencePage.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/NewRubyProjectPreferencePage.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/NewRubyProjectPreferencePage.java 2007-04-20 22:48:30 UTC (rev 2351)
@@ -0,0 +1,512 @@
+/**
+ * Copyright (c) 2007 Aptana, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl -v10.html. If redistributing this code,
+ * this entire header must remain intact.
+ *
+ * This file is based on a JDT equivalent:
+ ********************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+// AW
+package org.rubypeople.rdt.internal.ui.preferences;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.NoSuchElementException;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.PlatformUI;
+import org.rubypeople.rdt.core.ILoadpathEntry;
+import org.rubypeople.rdt.core.RubyConventions;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.internal.core.util.Messages;
+import org.rubypeople.rdt.internal.ui.IRubyHelpContextIds;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.dialogs.StatusInfo;
+import org.rubypeople.rdt.internal.ui.dialogs.StatusUtil;
+import org.rubypeople.rdt.ui.PreferenceConstants;
+import org.rubypeople.rdt.ui.RubyUI;
+
+/*
+ * The page for defaults for loadpath entries in new ruby projects.
+ * See PreferenceConstants to access or change these values through public API.
+ */
+public class NewRubyProjectPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+
+ public static final String ID= "org.rubypeople.rdt.ui.preferences.BuildPathPreferencePage"; //$NON-NLS-1$
+
+ private static final String SRCBIN_FOLDERS_IN_NEWPROJ= PreferenceConstants.SRCBIN_FOLDERS_IN_NEWPROJ;
+ private static final String SRCBIN_SRCNAME= PreferenceConstants.SRCBIN_SRCNAME;
+
+ private static final String LOADPATH_JRELIBRARY_INDEX= PreferenceConstants.NEWPROJECT_JRELIBRARY_INDEX;
+ private static final String LOADPATH_JRELIBRARY_LIST= PreferenceConstants.NEWPROJECT_JRELIBRARY_LIST;
+
+
+ private static String fgDefaultEncoding= System.getProperty("file.encoding"); //$NON-NLS-1$
+
+ public static ILoadpathEntry[] getDefaultJRELibrary() {
+ IPreferenceStore store= RubyPlugin.getDefault().getPreferenceStore();
+
+ String str= store.getString(LOADPATH_JRELIBRARY_LIST);
+ int index= store.getInt(LOADPATH_JRELIBRARY_INDEX);
+
+ StringTokenizer tok= new StringTokenizer(str, ";"); //$NON-NLS-1$
+ while (tok.hasMoreTokens() && index > 0) {
+ tok.nextToken();
+ index--;
+ }
+
+ if (tok.hasMoreTokens()) {
+ ILoadpathEntry[] res= decodeJRELibraryLoadpathEntries(tok.nextToken());
+ if (res.length > 0) {
+ return res;
+ }
+ }
+ return new ILoadpathEntry[] { getJREContainerEntry() };
+ }
+
+ // JRE Entry
+
+ public static String decodeJRELibraryDescription(String encoded) {
+ int end= encoded.indexOf(' ');
+ if (end != -1) {
+ return decode(encoded.substring(0, end));
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ private static String decode(String str) {
+ try {
+ return URLDecoder.decode(str, fgDefaultEncoding);
+ } catch (UnsupportedEncodingException e) {
+ RubyPlugin.log(e);
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ private static String encode(String str) {
+ try {
+ return URLEncoder.encode(str, fgDefaultEncoding);
+ } catch (UnsupportedEncodingException e) {
+ RubyPlugin.log(e);
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ public static ILoadpathEntry[] decodeJRELibraryLoadpathEntries(String encoded) {
+ StringTokenizer tok= new StringTokenizer(encoded, " "); //$NON-NLS-1$
+ ArrayList res= new ArrayList();
+ while (tok.hasMoreTokens()) {
+ try {
+ tok.nextToken(); // desc: ignore
+ int kind= Integer.parseInt(tok.nextToken());
+ IPath path= decodePath(tok.nextToken());
+ boolean isExported= Boolean.valueOf(tok.nextToken()).booleanValue();
+ switch (kind) {
+ case ILoadpathEntry.CPE_SOURCE:
+ res.add(RubyCore.newSourceEntry(path));
+ break;
+ case ILoadpathEntry.CPE_LIBRARY:
+ res.add(RubyCore.newLibraryEntry(path, isExported));
+ break;
+ case ILoadpathEntry.CPE_VARIABLE:
+ res.add(RubyCore.newVariableEntry(path, isExported));
+ break;
+ case ILoadpathEntry.CPE_PROJECT:
+ res.add(RubyCore.newProjectEntry(path, isExported));
+ break;
+ case ILoadpathEntry.CPE_CONTAINER:
+ res.add(RubyCore.newContainerEntry(path, isExported));
+ break;
+ }
+ } catch (NumberFormatException e) {
+ String message= PreferencesMessages.NewRubyProjectPreferencePage_error_decode;
+ RubyPlugin.log(new Status(IStatus.ERROR, RubyUI.ID_PLUGIN, IStatus.ERROR, message, e));
+ } catch (NoSuchElementException e) {
+ String message= PreferencesMessages.NewRubyProjectPreferencePage_error_decode;
+ RubyPlugin.log(new Status(IStatus.ERROR, RubyUI.ID_PLUGIN, IStatus.ERROR, message, e));
+ }
+ }
+ return (ILoadpathEntry[]) res.toArray(new ILoadpathEntry[res.size()]);
+ }
+
+
+ public static String encodeJRELibrary(String desc, ILoadpathEntry[] cpentries) {
+ StringBuffer buf= new StringBuffer();
+ for (int i= 0; i < cpentries.length; i++) {
+ ILoadpathEntry entry= cpentries[i];
+ buf.append(encode(desc));
+ buf.append(' ');
+ buf.append(entry.getEntryKind());
+ buf.append(' ');
+ buf.append(encodePath(entry.getPath()));
+ buf.append(' ');
+ buf.append(entry.isExported());
+ buf.append(' ');
+ }
+ return buf.toString();
+ }
+
+ private static String encodePath(IPath path) {
+ if (path == null) {
+ return "#"; //$NON-NLS-1$
+ } else if (path.isEmpty()) {
+ return "&"; //$NON-NLS-1$
+ } else {
+ return encode(path.toPortableString());
+ }
+ }
+
+ private static IPath decodePath(String str) {
+ if ("#".equals(str)) { //$NON-NLS-1$
+ return null;
+ } else if ("&".equals(str)) { //$NON-NLS-1$
+ return Path.EMPTY;
+ } else {
+ return Path.fromPortableString(decode(str));
+ }
+ }
+
+
+ private ArrayList fCheckBoxes;
+ private ArrayList fRadioButtons;
+ private ArrayList fTextControls;
+
+ private SelectionListener fSelectionListener;
+ private ModifyListener fModifyListener;
+
+ private Text fSrcFolderNameText;
+
+ private Combo fJRECombo;
+
+ private Button fProjectAsSourceFolder;
+ private Button fFoldersAsSourceFolder;
+
+ private Label fSrcFolderNameLabel;
+
+ public NewRubyProjectPreferencePage() {
+ super();
+ setPreferenceStore(RubyPlugin.getDefault().getPreferenceStore());
+ setDescription(PreferencesMessages.NewRubyProjectPreferencePage_description);
+
+ // title used when opened programatically
+ setTitle(PreferencesMessages.NewRubyProjectPreferencePage_title);
+
+ fRadioButtons= new ArrayList();
+ fCheckBoxes= new ArrayList();
+ fTextControls= new ArrayList();
+
+ fSelectionListener= new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {}
+
+ public void widgetSelected(SelectionEvent e) {
+ controlChanged(e.widget);
+ }
+ };
+
+ fModifyListener= new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ controlModified(e.widget);
+ }
+ };
+
+ }
+
+ public static void initDefaults(IPreferenceStore store) {
+ store.setDefault(SRCBIN_FOLDERS_IN_NEWPROJ, false);
+ store.setDefault(SRCBIN_SRCNAME, "src"); //$NON-NLS-1$
+
+ store.setDefault(LOADPATH_JRELIBRARY_LIST, getDefaultJRELibraries());
+ store.setDefault(LOADPATH_JRELIBRARY_INDEX, 0);
+ }
+
+ private static String getDefaultJRELibraries() {
+ StringBuffer buf= new StringBuffer();
+ ILoadpathEntry cntentry= getJREContainerEntry();
+ buf.append(encodeJRELibrary(PreferencesMessages.NewRubyProjectPreferencePage_jre_container_description, new ILoadpathEntry[] { cntentry} ));
+ buf.append(';');
+ ILoadpathEntry varentry= getJREVariableEntry();
+ buf.append(encodeJRELibrary(PreferencesMessages.NewRubyProjectPreferencePage_jre_variable_description, new ILoadpathEntry[] { varentry }));
+ buf.append(';');
+ return buf.toString();
+ }
+
+ private static ILoadpathEntry getJREContainerEntry() {
+ return RubyCore.newContainerEntry(new Path("org.rubypeople.rdt.launching.RUBY_CONTAINER")); //$NON-NLS-1$
+ }
+
+ private static ILoadpathEntry getJREVariableEntry() {
+ return RubyCore.newVariableEntry(new Path("RUBY_LIB")); //$NON-NLS-1$
+ }
+
+ /*
+ * @see IWorkbenchPreferencePage#init(IWorkbench)
+ */
+ pub...
[truncated message content] |