You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
(41) |
Apr
(9) |
May
|
Jun
|
Jul
(39) |
Aug
(38) |
Sep
(135) |
Oct
(220) |
Nov
(75) |
Dec
(74) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(44) |
Feb
(160) |
Mar
(49) |
Apr
(69) |
May
(40) |
Jun
(52) |
Jul
(47) |
Aug
(51) |
Sep
(19) |
Oct
(22) |
Nov
(36) |
Dec
(76) |
| 2007 |
Jan
(154) |
Feb
(165) |
Mar
(186) |
Apr
(143) |
May
(175) |
Jun
(133) |
Jul
(203) |
Aug
(177) |
Sep
(136) |
Oct
|
Nov
|
Dec
|
|
From: <caw...@us...> - 2007-07-25 17:35:07
|
Revision: 2847
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2847&view=rev
Author: cawilliams
Date: 2007-07-25 10:35:02 -0700 (Wed, 25 Jul 2007)
Log Message:
-----------
break out UI related items into new com.aptana.rdt.ui plugin
Removed Paths:
-------------
trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemContentProvider.java
trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemLabelProvider.java
trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsMessages.java
trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsMessages.properties
trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsView.java
trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/InstallGemDialog.java
trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/RemoveGemDialog.java
Deleted: trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemContentProvider.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemContentProvider.java 2007-07-25 17:29:26 UTC (rev 2846)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemContentProvider.java 2007-07-25 17:35:02 UTC (rev 2847)
@@ -1,25 +0,0 @@
-package com.aptana.rdt.ui.gems;
-
-import java.util.Collection;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-public class GemContentProvider implements IStructuredContentProvider {
-
- public Object[] getElements(Object inputElement) {
- Object[] res = null;
- if (inputElement instanceof Collection) {
- res = ((Collection) inputElement).toArray();
- }
-
- return res;
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public void dispose() {
- }
-
-}
Deleted: trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemLabelProvider.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemLabelProvider.java 2007-07-25 17:29:26 UTC (rev 2846)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemLabelProvider.java 2007-07-25 17:35:02 UTC (rev 2847)
@@ -1,36 +0,0 @@
-package com.aptana.rdt.ui.gems;
-
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-import com.aptana.rdt.core.gems.Gem;
-
-public class GemLabelProvider extends LabelProvider implements ITableLabelProvider {
-
- private static final int NAME_COLUMN = 0;
- private static final int VERSION_COLUMN = 1;
- private static final int DESCRIPTION_COLUMN = 2;
-
- public Image getColumnImage(Object element, int columnIndex) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- Gem server = (Gem) element;
-
- switch (columnIndex) {
- case NAME_COLUMN:
- return server.getName();
- case VERSION_COLUMN:
- return server.getVersion();
- case DESCRIPTION_COLUMN:
- return server.getDescription();
- default:
- return "";
- }
- }
-
-
-}
Deleted: trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsMessages.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsMessages.java 2007-07-25 17:29:26 UTC (rev 2846)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsMessages.java 2007-07-25 17:35:02 UTC (rev 2847)
@@ -1,25 +0,0 @@
-package com.aptana.rdt.ui.gems;
-
-import org.eclipse.osgi.util.NLS;
-
-public class GemsMessages extends NLS {
-
- private static final String BUNDLE_NAME = GemsMessages.class.getName();
-
- public static String GemsView_NameColumn_label;
- public static String GemsView_VersionColumn_label;
- public static String GemsView_DescriptionColumn_label;
- public static String InstallGemDialog_dialog_title;
- public static String InstallGemDialog_version_label;
- public static String InstallGemDialog_name_label;
- public static String GemManager_loading_local_gems;
- public static String GemManager_loading_remote_gems;
- public static String RemoveGemDialog_msg;
- public static String RemoveGemDialog_dialog_title;
- public static String RemoveGemDialog_version_label;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, GemsMessages.class);
- }
-
-}
Deleted: trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsMessages.properties
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsMessages.properties 2007-07-25 17:29:26 UTC (rev 2846)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsMessages.properties 2007-07-25 17:35:02 UTC (rev 2847)
@@ -1,28 +0,0 @@
-###############################################################################
-# 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.
-###############################################################################
-# messages.properties
-# contains externalized strings for com.aptana.rdt
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# This file should be translated.
-GemsView_NameColumn_label=Name
-GemsView_VersionColumn_label=Version
-GemsView_DescriptionColumn_label=Description
-
-InstallGemDialog_dialog_title=Install a gem
-InstallGemDialog_version_label=Version:
-InstallGemDialog_name_label=Gem Name:
-
-GemManager_loading_local_gems=Loading local gem information
-GemManager_loading_remote_gems=Loading remote gem information
-
-RemoveGemDialog_msg=Are you sure you want to remove the gem {0}?
-
-RemoveGemDialog_version_label=Version:
-RemoveGemDialog_dialog_title=Which Version?
\ No newline at end of file
Deleted: trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsView.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsView.java 2007-07-25 17:29:26 UTC (rev 2846)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsView.java 2007-07-25 17:35:02 UTC (rev 2847)
@@ -1,158 +0,0 @@
-package com.aptana.rdt.ui.gems;
-
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.part.ViewPart;
-import org.rubypeople.rdt.ui.TableViewerSorter;
-
-import com.aptana.rdt.AptanaRDTPlugin;
-import com.aptana.rdt.core.gems.Gem;
-import com.aptana.rdt.core.gems.GemListener;
-
-public class GemsView extends ViewPart implements GemListener {
-
- private TableViewer gemViewer;
-
- @Override
- public void createPartControl(Composite parent) {
- parent.setLayout(new GridLayout());
-
- gemViewer = new TableViewer(parent, SWT.SINGLE | SWT.FULL_SELECTION);
- final Table gemTable = gemViewer.getTable();
- gemTable.setHeaderVisible(true);
- gemTable.setLinesVisible(false);
- gemTable.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- gemTable.addKeyListener(new KeyListener() {
-
- public void keyReleased(KeyEvent e) {
- // ignore
- }
-
- public void keyPressed(KeyEvent e) {
- if (e.keyCode == SWT.DEL) {
- TableItem item = gemTable.getItem(gemTable.getSelectionIndex());
- Gem gem = (Gem) item.getData();
- if (MessageDialog.openConfirm(gemTable.getShell(), null, GemsMessages.bind(GemsMessages.RemoveGemDialog_msg, gem.getName()))) {
- AptanaRDTPlugin.getDefault().getGemManager().removeGem(gem);
- }
- }
- }
-
- });
-
- TableColumn nameColumn = new TableColumn(gemTable, SWT.LEFT);
- nameColumn.setText(GemsMessages.GemsView_NameColumn_label);
- nameColumn.setWidth(150);
-
- TableColumn versionColumn = new TableColumn(gemTable, SWT.LEFT);
- versionColumn.setText(GemsMessages.GemsView_VersionColumn_label);
- versionColumn.setWidth(75);
-
- TableColumn descriptionColumn = new TableColumn(gemTable, SWT.LEFT);
- descriptionColumn
- .setText(GemsMessages.GemsView_DescriptionColumn_label);
- descriptionColumn.setWidth(275);
-
- gemViewer.setLabelProvider(new GemLabelProvider());
- gemViewer.setContentProvider(new GemContentProvider());
- TableViewerSorter.bind(gemViewer);
- getSite().setSelectionProvider(gemViewer);
-
-
- gemViewer.setInput(AptanaRDTPlugin.getDefault().getGemManager().getGems());
- createPopupMenu();
-
- AptanaRDTPlugin.getDefault().getGemManager().addGemListener(this);
- }
-
- @Override
- public void setFocus() {
- gemViewer.getTable().setFocus();
- }
-
- /**
- * Creates and registers the context menu
- */
- private void createPopupMenu() {
- MenuManager menuMgr = new MenuManager("#PopupMenu");
- menuMgr.setRemoveAllWhenShown(true);
-
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- IContributionItem[] items = getViewSite().getActionBars()
- .getToolBarManager().getItems();
- for (int i = 0; i < items.length; i++) {
- if (items[i] instanceof ActionContributionItem) {
- ActionContributionItem aci = (ActionContributionItem) items[i];
- manager.add(aci.getAction());
- }
- }
- }
- });
- menuMgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); // Allow
- // other
- // plugins
- // to
- // add
- // here
- Menu menu = menuMgr.createContextMenu(gemViewer.getControl());
- gemViewer.getControl().setMenu(menu);
- getSite().registerContextMenu(menuMgr, gemViewer);
- }
-
- public void gemsRefreshed() {
- Display.getDefault().asyncExec(new Runnable() {
-
- public void run() {
- gemViewer.setInput(AptanaRDTPlugin.getDefault().getGemManager().getGems());
- gemViewer.refresh();
- }
-
- });
-
- }
-
- public void gemAdded(final Gem gem) {
- Display.getDefault().asyncExec(new Runnable() {
-
- public void run() {
- gemViewer.setInput(AptanaRDTPlugin.getDefault().getGemManager().getGems());
- }
-
- });
- }
-
- public void gemRemoved(final Gem gem) {
- Display.getDefault().asyncExec(new Runnable() {
-
- public void run() {
- gemViewer.setInput(AptanaRDTPlugin.getDefault().getGemManager().getGems());
- }
-
- });
- }
-
- public void managerInitialized() {
- // ignore
- }
-
-}
Deleted: trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/InstallGemDialog.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/InstallGemDialog.java 2007-07-25 17:29:26 UTC (rev 2846)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/InstallGemDialog.java 2007-07-25 17:35:02 UTC (rev 2847)
@@ -1,177 +0,0 @@
-package com.aptana.rdt.ui.gems;
-
-import java.util.SortedSet;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.Text;
-import org.rubypeople.rdt.ui.TableViewerSorter;
-
-import com.aptana.rdt.AptanaRDTPlugin;
-import com.aptana.rdt.core.gems.Gem;
-import com.aptana.rdt.internal.core.gems.GemManager;
-import com.aptana.rdt.internal.core.gems.LogicalGem;
-
-public class InstallGemDialog extends Dialog {
-
- private Text nameText;
- private Combo versionCombo;
-
- private String name;
- private String version;
-
- private boolean filterByText = true;
-
- private TableViewer gemViewer;
- private GemContentProvider contentProvider;
-
- public InstallGemDialog(Shell parentShell) {
- super(parentShell);
- contentProvider = new GemContentProvider();
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- getShell().setText(GemsMessages.InstallGemDialog_dialog_title);
- Composite control = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- control.setLayout(layout);
-
- Label nameLabel = new Label(control, SWT.LEFT);
- nameLabel.setText(GemsMessages.InstallGemDialog_name_label);
-
- nameText = new Text(control, SWT.BORDER);
- GridData nameTextData = new GridData();
- nameTextData.widthHint = 150;
- nameText.setLayoutData(nameTextData);
- nameText.addModifyListener(new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- if (filterByText) {
- getShell().getDisplay().syncExec(new Runnable() {
-
- public void run() {
- gemViewer.refresh();
- }
- });
- }
- filterByText = true;
- }
-
- });
-
- Label versionLabel = new Label(control, SWT.LEFT);
- versionLabel.setText(GemsMessages.InstallGemDialog_version_label);
-
- versionCombo = new Combo(control, SWT.DROP_DOWN);
- GridData versionComboData = new GridData();
- versionComboData.widthHint = 100;
- versionCombo.setLayoutData(versionComboData);
-
- gemViewer = new TableViewer(parent, SWT.SINGLE | SWT.FULL_SELECTION);
- Table serverTable = gemViewer.getTable();
- serverTable.setHeaderVisible(true);
- serverTable.setLinesVisible(false);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.heightHint = 400;
- serverTable.setLayoutData(data);
-
- TableColumn nameColumn = new TableColumn(serverTable, SWT.LEFT);
- nameColumn.setText(GemsMessages.GemsView_NameColumn_label);
- nameColumn.setWidth(150);
-
- TableColumn versionColumn = new TableColumn(serverTable, SWT.LEFT);
- versionColumn.setText(GemsMessages.GemsView_VersionColumn_label);
- versionColumn.setWidth(75);
-
- TableColumn descriptionColumn = new TableColumn(serverTable, SWT.LEFT);
- descriptionColumn
- .setText(GemsMessages.GemsView_DescriptionColumn_label);
- descriptionColumn.setWidth(275);
-
- gemViewer.setLabelProvider(new GemLabelProvider());
- gemViewer.setContentProvider(contentProvider);
- TableViewerSorter.bind(gemViewer);
- gemViewer.setInput(AptanaRDTPlugin.getDefault().getGemManager().getRemoteGems());
- gemViewer.addFilter(new MyViewerFilter(nameText));
-
- gemViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection structured = (IStructuredSelection) selection;
- LogicalGem gem = (LogicalGem) structured.getFirstElement();
- SortedSet<String> versions = gem.getVersions();
- filterByText = false; // don't filter list when I programmatically set text
- nameText.setText(gem.getName());
- versionCombo.removeAll();
- String lastVersion = null;
- for (String version : versions) {
- versionCombo.add(version);
- lastVersion = version;
- }
- versionCombo.setText(lastVersion);
- }
- }
-
- });
-
- return control;
- }
-
- /**
- * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
- */
- public void buttonPressed(int buttonId) {
- if (buttonId == IDialogConstants.OK_ID) {
- name = nameText.getText();
- version = versionCombo.getText();
- okPressed();
- } else if (buttonId == IDialogConstants.CANCEL_ID) {
- cancelPressed();
- }
- }
-
- public Gem getGem() {
- return new Gem(name, version, "");
- }
-
- private static class MyViewerFilter extends ViewerFilter {
-
- private Text text;
-
- public MyViewerFilter(Text text) {
- this.text = text;
- }
-
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- Gem gem = (Gem) element;
- // TODO If there's no text show nothing?
- return gem.getName().toLowerCase().startsWith(text.getText().toLowerCase());
- }
-
- }
-
-}
Deleted: trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/RemoveGemDialog.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/RemoveGemDialog.java 2007-07-25 17:29:26 UTC (rev 2846)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/RemoveGemDialog.java 2007-07-25 17:35:02 UTC (rev 2847)
@@ -1,70 +0,0 @@
-package com.aptana.rdt.ui.gems;
-
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-public class RemoveGemDialog extends Dialog {
-
- private Combo versionCombo;
- private String version;
- private List<String> versions;
-
- public RemoveGemDialog(Shell parentShell, List<String> versions) {
- super(parentShell);
- this.versions = versions;
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- getShell().setText(GemsMessages.RemoveGemDialog_dialog_title);
-
- Composite control = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- control.setLayout(layout);
-
- Label versionLabel = new Label(control, SWT.LEFT);
- versionLabel.setText(GemsMessages.RemoveGemDialog_version_label);
-
- versionCombo = new Combo(control, SWT.DROP_DOWN);
- GridData versionComboData = new GridData();
- versionComboData.widthHint = 100;
- versionCombo.setLayoutData(versionComboData);
-
- for (String version : versions) {
- versionCombo.add(version);
- }
- // Set the oldest version as default option
- if (versions != null && !versions.isEmpty()) {
- versionCombo.select(versions.size() - 1);
- }
- return control;
- }
-
- /**
- * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
- */
- public void buttonPressed(int buttonId) {
- if (buttonId == IDialogConstants.OK_ID) {
- version = versionCombo.getText();
- okPressed();
- } else if (buttonId == IDialogConstants.CANCEL_ID) {
- cancelPressed();
- }
- }
-
- public String getVersion() {
- return version;
- }
-
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-25 17:29:27
|
Revision: 2846
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2846&view=rev
Author: cawilliams
Date: 2007-07-25 10:29:26 -0700 (Wed, 25 Jul 2007)
Log Message:
-----------
break out UI related items into new com.aptana.rdt.ui plugin
Modified Paths:
--------------
trunk/com.aptana.rdt.ui/META-INF/MANIFEST.MF
trunk/com.aptana.rdt.ui/build.properties
Added Paths:
-----------
trunk/com.aptana.rdt.ui/icons/
trunk/com.aptana.rdt.ui/plugin.xml
Modified: trunk/com.aptana.rdt.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/com.aptana.rdt.ui/META-INF/MANIFEST.MF 2007-07-25 17:29:08 UTC (rev 2845)
+++ trunk/com.aptana.rdt.ui/META-INF/MANIFEST.MF 2007-07-25 17:29:26 UTC (rev 2846)
@@ -1,12 +1,16 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Aptana RDT UI Extensions
-Bundle-SymbolicName: com.aptana.rdt.ui
+Bundle-SymbolicName: com.aptana.rdt.ui;singleton:=true
Bundle-Version: 0.0.0
Bundle-Activator: com.aptana.rdt.ui.AptanaRDTUIPlugin
Bundle-Vendor: Aptana, Inc.
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
- com.aptana.rdt
+ org.eclipse.jface.text,
+ org.rubypeople.rdt.core,
+ com.aptana.rdt,
+ org.rubypeople.rdt.ui
Eclipse-LazyStart: true
+Export-Package: com.aptana.rdt.internal.ui.preferences
Modified: trunk/com.aptana.rdt.ui/build.properties
===================================================================
--- trunk/com.aptana.rdt.ui/build.properties 2007-07-25 17:29:08 UTC (rev 2845)
+++ trunk/com.aptana.rdt.ui/build.properties 2007-07-25 17:29:26 UTC (rev 2846)
@@ -1,4 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
- .
+ .,\
+ plugin.xml
Copied: trunk/com.aptana.rdt.ui/icons (from rev 2706, trunk/com.aptana.rdt/icons)
Added: trunk/com.aptana.rdt.ui/plugin.xml
===================================================================
--- trunk/com.aptana.rdt.ui/plugin.xml (rev 0)
+++ trunk/com.aptana.rdt.ui/plugin.xml 2007-07-25 17:29:26 UTC (rev 2846)
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension targetID="org.rubypeople.rdt.ui.RubyBrowsingPerspective">
+ <perspectiveShortcut id="org.radrails.rails.ui.PerspectiveRails"/>
+ </perspectiveExtension>
+ <perspectiveExtension targetID="org.eclipse.debug.ui.DebugPerspective">
+ <perspectiveShortcut id="org.radrails.rails.ui.PerspectiveRails"/>
+ </perspectiveExtension>
+ <perspectiveExtension targetID="org.eclipse.ui.resourcePerspective">
+ <perspectiveShortcut id="org.radrails.rails.ui.PerspectiveRails" />
+ </perspectiveExtension>
+ <perspectiveExtension targetID="org.rubypeople.rdt.ui.PerspectiveRuby">
+ <perspectiveShortcut id="org.radrails.rails.ui.PerspectiveRails" />
+ </perspectiveExtension>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ name="Rails API"
+ icon="icons/full/elcl16/rails.gif"
+ category="org.radrails.rails.ui.ViewCategoryRails"
+ class="com.aptana.rdt.internal.ui.infoviews.RailsAPIView"
+ id="com.aptana.rdt.ui.views.RailsAPIView">
+ </view>
+ <view
+ name="Ruby Core API"
+ icon="icons/full/elcl16/rubydoc.gif"
+ category="org.rubypeople.rdt.ui.ruby"
+ class="com.aptana.rdt.internal.ui.infoviews.RubyCoreAPIView"
+ id="com.aptana.rdt.ui.views.RubyCoreAPIView">
+ </view>
+ <view
+ name="Ruby Standard Library API"
+ icon="icons/full/elcl16/rubydoc.gif"
+ category="org.rubypeople.rdt.ui.ruby"
+ class="com.aptana.rdt.internal.ui.infoviews.RubyStdLibAPIView"
+ id="com.aptana.rdt.ui.views.RubyStdLibAPIView">
+ </view>
+ <view
+ category="org.rubypeople.rdt.ui.ruby"
+ class="com.aptana.rdt.ui.gems.GemsView"
+ icon="icons/rubygems.png"
+ id="com.aptana.gems.ui.ViewGems"
+ name="RubyGems"/>
+ </extension>
+
+ <extension point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension targetID="org.rubypeople.rdt.ui.PerspectiveRuby">
+ <viewShortcut id="com.aptana.rdt.ui.views.RubyStdLibAPIView"/>
+ <viewShortcut id="com.aptana.rdt.ui.views.RubyCoreAPIView"/>
+ </perspectiveExtension>
+ </extension>
+
+ <extension
+ point="org.rubypeople.rdt.ui.quickFixProcessors">
+ <quickFixProcessor
+ name="%defaultQuickFixProcessor"
+ class="com.aptana.rdt.internal.ui.text.correction.QuickFixProcessor"
+ id="com.aptana.rdt.ui.text.correction.QuickFixProcessor">
+ </quickFixProcessor>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.viewActions">
+ <viewContribution
+ id="com.aptana.gems.ui.ViewActions"
+ targetID="com.aptana.gems.ui.ViewGems">
+ <action
+ class="com.aptana.rdt.internal.ui.actions.InstallGemActionDelegate"
+ icon="icons/add.gif"
+ id="com.aptana.gems.ui.ActionInstallGem"
+ label="Install"
+ style="push"
+ toolbarPath="additions"
+ tooltip="Install"/>
+ <action
+ class="com.aptana.rdt.internal.ui.actions.RemoveGemActionDelegate"
+ icon="icons/remove.gif"
+ id="com.aptana.gems.ui.ActionRemoveGem"
+ label="Remove"
+ style="push"
+ toolbarPath="additions"
+ enablesFor="1"
+ tooltip="Remove"/>
+ <action
+ class="com.aptana.rdt.internal.ui.actions.RefreshGemsActionDelegate"
+ icon="icons/nav_refresh.gif"
+ id="com.aptana.gems.ui.ActionRefreshGems"
+ label="Refresh"
+ style="push"
+ toolbarPath="additions"
+ tooltip="Refresh"/>
+ <action
+ class="com.aptana.rdt.internal.ui.actions.UpdateGemActionDelegate"
+ icon="icons/ruby_get.png"
+ id="com.aptana.gems.ui.ActionUpdateGem"
+ label="Update Gem"
+ style="push"
+ enablesFor="1"
+ toolbarPath="additions"
+ tooltip="Update Gem"/>
+ <action
+ class="com.aptana.rdt.internal.ui.actions.UpdateAllActionDelegate"
+ icon="icons/upgrade.gif"
+ id="com.aptana.gems.ui.ActionUpdateAllGems"
+ label="Update All Gems"
+ style="push"
+ toolbarPath="additions"
+ tooltip="Update All Gems"/>
+ </viewContribution>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup class="com.aptana.rdt.ui.RubyGemsInitializer"/>
+ </extension>
+</plugin>
Property changes on: trunk/com.aptana.rdt.ui/plugin.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-25 17:29:12
|
Revision: 2845
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2845&view=rev
Author: cawilliams
Date: 2007-07-25 10:29:08 -0700 (Wed, 25 Jul 2007)
Log Message:
-----------
break out UI related items into new com.aptana.rdt.ui plugin
Added Paths:
-----------
trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/infoviews/
trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/preferences/
trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/
trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/
Copied: trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/infoviews (from rev 2706, trunk/com.aptana.rdt/src/com/aptana/rdt/internal/ui/infoviews)
Copied: trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/preferences (from rev 2706, trunk/com.aptana.rdt/src/com/aptana/rdt/internal/ui/preferences)
Copied: trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction (from rev 2706, trunk/com.aptana.rdt/src/com/aptana/rdt/internal/ui/text/correction)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-25 17:28:57
|
Revision: 2844
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2844&view=rev
Author: cawilliams
Date: 2007-07-25 10:28:51 -0700 (Wed, 25 Jul 2007)
Log Message:
-----------
break out UI related items into new com.aptana.rdt.ui plugin
Added Paths:
-----------
trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/
trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-25 17:27:59
|
Revision: 2843
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2843&view=rev
Author: cawilliams
Date: 2007-07-25 10:27:57 -0700 (Wed, 25 Jul 2007)
Log Message:
-----------
break out UI related items into new com.aptana.rdt.ui plugin
Modified Paths:
--------------
trunk/com.aptana.rdt/META-INF/MANIFEST.MF
trunk/com.aptana.rdt/plugin.xml
trunk/com.aptana.rdt/src/com/aptana/rdt/AptanaRDTPlugin.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java
Added Paths:
-----------
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemsMessages.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemsMessages.properties
Removed Paths:
-------------
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/RubyGemsInitializer.java
trunk/com.aptana.rdt/src/com/aptana/rdt/ui/PreferenceConstants.java
Modified: trunk/com.aptana.rdt/META-INF/MANIFEST.MF
===================================================================
--- trunk/com.aptana.rdt/META-INF/MANIFEST.MF 2007-07-25 17:06:41 UTC (rev 2842)
+++ trunk/com.aptana.rdt/META-INF/MANIFEST.MF 2007-07-25 17:27:57 UTC (rev 2843)
@@ -9,18 +9,14 @@
Bundle-Vendor: Aptana, Inc.
Export-Package: com.aptana.rdt,
com.aptana.rdt.core.gems,
- com.aptana.rdt.launching,
com.aptana.rdt.internal.core.gems;x-friends:="com.aptana.rdt.tests",
com.aptana.rdt.internal.parser.warnings,
- com.aptana.rdt.internal.ui.preferences
+ com.aptana.rdt.launching
Require-Bundle: org.eclipse.core.resources,
org.eclipse.core.runtime,
org.eclipse.jface.text,
- org.eclipse.ui,
- org.eclipse.ui.intro,
org.eclipse.debug.core,
org.eclipse.debug.ui,
org.jruby,
org.rubypeople.rdt.core,
- org.rubypeople.rdt.launching,
- org.rubypeople.rdt.ui
+ org.rubypeople.rdt.launching
Modified: trunk/com.aptana.rdt/plugin.xml
===================================================================
--- trunk/com.aptana.rdt/plugin.xml 2007-07-25 17:06:41 UTC (rev 2842)
+++ trunk/com.aptana.rdt/plugin.xml 2007-07-25 17:27:57 UTC (rev 2843)
@@ -1,69 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
-
- <extension point="org.eclipse.ui.perspectiveExtensions">
- <perspectiveExtension targetID="org.rubypeople.rdt.ui.RubyBrowsingPerspective">
- <perspectiveShortcut id="org.radrails.rails.ui.PerspectiveRails"/>
- </perspectiveExtension>
- <perspectiveExtension targetID="org.eclipse.debug.ui.DebugPerspective">
- <perspectiveShortcut id="org.radrails.rails.ui.PerspectiveRails"/>
- </perspectiveExtension>
- <perspectiveExtension targetID="org.eclipse.ui.resourcePerspective">
- <perspectiveShortcut id="org.radrails.rails.ui.PerspectiveRails" />
- </perspectiveExtension>
- <perspectiveExtension targetID="org.rubypeople.rdt.ui.PerspectiveRuby">
- <perspectiveShortcut id="org.radrails.rails.ui.PerspectiveRails" />
- </perspectiveExtension>
- </extension>
-
- <extension
- point="org.eclipse.ui.views">
- <view
- name="Rails API"
- icon="icons/full/elcl16/rails.gif"
- category="org.radrails.rails.ui.ViewCategoryRails"
- class="com.aptana.rdt.internal.ui.infoviews.RailsAPIView"
- id="com.aptana.rdt.ui.views.RailsAPIView">
- </view>
- <view
- name="Ruby Core API"
- icon="icons/full/elcl16/rubydoc.gif"
- category="org.rubypeople.rdt.ui.ruby"
- class="com.aptana.rdt.internal.ui.infoviews.RubyCoreAPIView"
- id="com.aptana.rdt.ui.views.RubyCoreAPIView">
- </view>
- <view
- name="Ruby Standard Library API"
- icon="icons/full/elcl16/rubydoc.gif"
- category="org.rubypeople.rdt.ui.ruby"
- class="com.aptana.rdt.internal.ui.infoviews.RubyStdLibAPIView"
- id="com.aptana.rdt.ui.views.RubyStdLibAPIView">
- </view>
- <view
- category="org.rubypeople.rdt.ui.ruby"
- class="com.aptana.rdt.ui.gems.GemsView"
- icon="icons/rubygems.png"
- id="com.aptana.gems.ui.ViewGems"
- name="RubyGems"/>
- </extension>
-
- <extension point="org.eclipse.ui.perspectiveExtensions">
- <perspectiveExtension targetID="org.rubypeople.rdt.ui.PerspectiveRuby">
- <viewShortcut id="com.aptana.rdt.ui.views.RubyStdLibAPIView"/>
- <viewShortcut id="com.aptana.rdt.ui.views.RubyCoreAPIView"/>
- </perspectiveExtension>
- </extension>
-
- <extension
- point="org.rubypeople.rdt.ui.quickFixProcessors">
- <quickFixProcessor
- name="%defaultQuickFixProcessor"
- class="com.aptana.rdt.internal.ui.text.correction.QuickFixProcessor"
- id="com.aptana.rdt.ui.text.correction.QuickFixProcessor">
- </quickFixProcessor>
- </extension>
- <extension
+ <extension
id="rubyredlint"
name="%annotationProcessingName"
point="org.rubypeople.rdt.core.compilationParticipant">
@@ -139,56 +77,6 @@
<argument prefKey="com.aptana.rdt.compiler.problem.maxReturns"/>
</error>
</extension>
-
- <extension
- point="org.eclipse.ui.viewActions">
- <viewContribution
- id="com.aptana.gems.ui.ViewActions"
- targetID="com.aptana.gems.ui.ViewGems">
- <action
- class="com.aptana.rdt.internal.ui.actions.InstallGemActionDelegate"
- icon="icons/add.gif"
- id="com.aptana.gems.ui.ActionInstallGem"
- label="Install"
- style="push"
- toolbarPath="additions"
- tooltip="Install"/>
- <action
- class="com.aptana.rdt.internal.ui.actions.RemoveGemActionDelegate"
- icon="icons/remove.gif"
- id="com.aptana.gems.ui.ActionRemoveGem"
- label="Remove"
- style="push"
- toolbarPath="additions"
- enablesFor="1"
- tooltip="Remove"/>
- <action
- class="com.aptana.rdt.internal.ui.actions.RefreshGemsActionDelegate"
- icon="icons/nav_refresh.gif"
- id="com.aptana.gems.ui.ActionRefreshGems"
- label="Refresh"
- style="push"
- toolbarPath="additions"
- tooltip="Refresh"/>
- <action
- class="com.aptana.rdt.internal.ui.actions.UpdateGemActionDelegate"
- icon="icons/ruby_get.png"
- id="com.aptana.gems.ui.ActionUpdateGem"
- label="Update Gem"
- style="push"
- enablesFor="1"
- toolbarPath="additions"
- tooltip="Update Gem"/>
- <action
- class="com.aptana.rdt.internal.ui.actions.UpdateAllActionDelegate"
- icon="icons/upgrade.gif"
- id="com.aptana.gems.ui.ActionUpdateAllGems"
- label="Update All Gems"
- style="push"
- toolbarPath="additions"
- tooltip="Update All Gems"/>
- </viewContribution>
- </extension>
<!-- =================================================================================== -->
<!-- Extension: Eclipse preferences initializer -->
@@ -197,11 +85,6 @@
point="org.eclipse.core.runtime.preferences">
<initializer class="com.aptana.rdt.internal.core.RubyRedPreferenceInitializer"/>
</extension>
-
- <extension
- point="org.eclipse.ui.startup">
- <startup class="com.aptana.rdt.internal.core.gems.RubyGemsInitializer"/>
- </extension>
<extension
point="org.rubypeople.rdt.core.loadpathVariableInitializer">
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/AptanaRDTPlugin.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/AptanaRDTPlugin.java 2007-07-25 17:06:41 UTC (rev 2842)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/AptanaRDTPlugin.java 2007-07-25 17:27:57 UTC (rev 2843)
@@ -12,18 +12,16 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IPreferencesService;
import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.rubypeople.rdt.internal.core.RubyModelManager.EclipsePreferencesListener;
import org.rubypeople.rdt.internal.launching.LaunchingPlugin;
-import org.rubypeople.rdt.internal.ui.IRubyStatusConstants;
import com.aptana.rdt.core.gems.Gem;
import com.aptana.rdt.core.gems.GemListener;
@@ -34,7 +32,7 @@
/**
* The activator class controls the plug-in life cycle
*/
-public class AptanaRDTPlugin extends AbstractUIPlugin {
+public class AptanaRDTPlugin extends Plugin {
// The plug-in ID
public static final String PLUGIN_ID = "com.aptana.rdt";
@@ -328,17 +326,6 @@
public static AptanaRDTPlugin getDefault() {
return plugin;
}
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path
- *
- * @param path the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- return imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
public static File getFileInPlugin(IPath path) {
try {
@@ -352,7 +339,7 @@
}
public static void log(Throwable e) {
- log(new Status(IStatus.ERROR, getPluginId(), IRubyStatusConstants.INTERNAL_ERROR, RubyRedMessages.RubyRedPlugin_internal_error, e));
+ log(new Status(IStatus.ERROR, getPluginId(), -1, RubyRedMessages.RubyRedPlugin_internal_error, e));
}
public static void log(IStatus status) {
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java 2007-07-25 17:06:41 UTC (rev 2842)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java 2007-07-25 17:27:57 UTC (rev 2843)
@@ -44,8 +44,6 @@
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.widgets.Display;
import org.rubypeople.rdt.launching.IRubyLaunchConfigurationConstants;
import org.rubypeople.rdt.launching.IVMInstall;
import org.rubypeople.rdt.launching.RubyRuntime;
@@ -57,8 +55,6 @@
import com.aptana.rdt.core.gems.Gem;
import com.aptana.rdt.core.gems.GemListener;
import com.aptana.rdt.core.gems.IGemManager;
-import com.aptana.rdt.ui.gems.GemsMessages;
-import com.aptana.rdt.ui.gems.RemoveGemDialog;
public class GemManager implements IGemManager {
@@ -438,14 +434,7 @@
* @see com.aptana.rdt.internal.gems.IGemManager#removeGem(com.aptana.rdt.internal.gems.Gem)
*/
public boolean removeGem(final Gem gem) {
- if (gem.hasMultipleVersions()) {
- RemoveGemDialog dialog = new RemoveGemDialog(Display.getDefault().getActiveShell(), gem.versions());
- if (dialog.open() == Dialog.OK) {
- return removeGem(new Gem(gem.getName(), dialog.getVersion(), null));
- } else {
- return false;
- }
- }
+ if (gem.hasMultipleVersions()) return false;
try {
String command = UNINSTALL_COMMAND + " " + gem.getName();
if (gem.getVersion() != null
Added: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemsMessages.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemsMessages.java (rev 0)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemsMessages.java 2007-07-25 17:27:57 UTC (rev 2843)
@@ -0,0 +1,15 @@
+package com.aptana.rdt.internal.core.gems;
+
+import org.eclipse.osgi.util.NLS;
+
+public class GemsMessages extends NLS {
+
+ private static final String BUNDLE_NAME = GemsMessages.class.getName();
+
+ public static String GemManager_loading_local_gems;
+ public static String GemManager_loading_remote_gems;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, GemsMessages.class);
+ }
+}
Property changes on: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemsMessages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemsMessages.properties
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemsMessages.properties (rev 0)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemsMessages.properties 2007-07-25 17:27:57 UTC (rev 2843)
@@ -0,0 +1,14 @@
+###############################################################################
+# 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.
+###############################################################################
+# contains externalized strings for com.aptana.rdt.internal.core.gems
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+GemManager_loading_local_gems=Loading local gem information
+GemManager_loading_remote_gems=Loading remote gem information
Property changes on: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemsMessages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/RubyGemsInitializer.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/RubyGemsInitializer.java 2007-07-25 17:06:41 UTC (rev 2842)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/RubyGemsInitializer.java 2007-07-25 17:27:57 UTC (rev 2843)
@@ -1,11 +0,0 @@
-package com.aptana.rdt.internal.core.gems;
-
-import org.eclipse.ui.IStartup;
-
-public class RubyGemsInitializer implements IStartup {
-
- public void earlyStartup() {
- GemManager.getInstance().initialize();
- }
-
-}
Deleted: trunk/com.aptana.rdt/src/com/aptana/rdt/ui/PreferenceConstants.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/ui/PreferenceConstants.java 2007-07-25 17:06:41 UTC (rev 2842)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/ui/PreferenceConstants.java 2007-07-25 17:27:57 UTC (rev 2843)
@@ -1,7 +0,0 @@
-package com.aptana.rdt.ui;
-
-public class PreferenceConstants {
- public static final String LICENSE_COMPANY_NAME = "licenseCompanyName"; //$NON-NLS-1$
- public static final String LICENSE_EMAIL = "licenseEmail"; //$NON-NLS-1$
- public static final String LICENSE_KEY = "licenseKey"; //$NON-NLS-1$
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-25 17:18:33
|
Revision: 2841
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2841&view=rev
Author: cawilliams
Date: 2007-07-25 10:06:15 -0700 (Wed, 25 Jul 2007)
Log Message:
-----------
Share project 'com.aptana.rdt.ui' into 'https://rubyeclipse.svn.sourceforge.net/svnroot/rubyeclipse'
Added Paths:
-----------
trunk/com.aptana.rdt.ui/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-25 17:06:47
|
Revision: 2842
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2842&view=rev
Author: cawilliams
Date: 2007-07-25 10:06:41 -0700 (Wed, 25 Jul 2007)
Log Message:
-----------
Share project 'com.aptana.rdt.ui' into 'https://rubyeclipse.svn.sourceforge.net/svnroot/rubyeclipse'
Added Paths:
-----------
trunk/com.aptana.rdt.ui/.classpath
trunk/com.aptana.rdt.ui/.project
trunk/com.aptana.rdt.ui/META-INF/
trunk/com.aptana.rdt.ui/META-INF/MANIFEST.MF
trunk/com.aptana.rdt.ui/bin/
trunk/com.aptana.rdt.ui/build.properties
trunk/com.aptana.rdt.ui/src/
trunk/com.aptana.rdt.ui/src/com/
trunk/com.aptana.rdt.ui/src/com/aptana/
trunk/com.aptana.rdt.ui/src/com/aptana/rdt/
trunk/com.aptana.rdt.ui/src/com/aptana/rdt/ui/
trunk/com.aptana.rdt.ui/src/com/aptana/rdt/ui/AptanaRDTUIPlugin.java
Added: trunk/com.aptana.rdt.ui/.classpath
===================================================================
--- trunk/com.aptana.rdt.ui/.classpath (rev 0)
+++ trunk/com.aptana.rdt.ui/.classpath 2007-07-25 17:06:41 UTC (rev 2842)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: trunk/com.aptana.rdt.ui/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/com.aptana.rdt.ui/.project
===================================================================
--- trunk/com.aptana.rdt.ui/.project (rev 0)
+++ trunk/com.aptana.rdt.ui/.project 2007-07-25 17:06:41 UTC (rev 2842)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>com.aptana.rdt.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/com.aptana.rdt.ui/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/com.aptana.rdt.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/com.aptana.rdt.ui/META-INF/MANIFEST.MF (rev 0)
+++ trunk/com.aptana.rdt.ui/META-INF/MANIFEST.MF 2007-07-25 17:06:41 UTC (rev 2842)
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Aptana RDT UI Extensions
+Bundle-SymbolicName: com.aptana.rdt.ui
+Bundle-Version: 0.0.0
+Bundle-Activator: com.aptana.rdt.ui.AptanaRDTUIPlugin
+Bundle-Vendor: Aptana, Inc.
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ com.aptana.rdt
+Eclipse-LazyStart: true
Property changes on: trunk/com.aptana.rdt.ui/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/com.aptana.rdt.ui/build.properties
===================================================================
--- trunk/com.aptana.rdt.ui/build.properties (rev 0)
+++ trunk/com.aptana.rdt.ui/build.properties 2007-07-25 17:06:41 UTC (rev 2842)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Property changes on: trunk/com.aptana.rdt.ui/build.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/com.aptana.rdt.ui/src/com/aptana/rdt/ui/AptanaRDTUIPlugin.java
===================================================================
--- trunk/com.aptana.rdt.ui/src/com/aptana/rdt/ui/AptanaRDTUIPlugin.java (rev 0)
+++ trunk/com.aptana.rdt.ui/src/com/aptana/rdt/ui/AptanaRDTUIPlugin.java 2007-07-25 17:06:41 UTC (rev 2842)
@@ -0,0 +1,50 @@
+package com.aptana.rdt.ui;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class AptanaRDTUIPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "com.aptana.rdt.ui";
+
+ // The shared instance
+ private static AptanaRDTUIPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public AptanaRDTUIPlugin() {
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static AptanaRDTUIPlugin getDefault() {
+ return plugin;
+ }
+
+}
Property changes on: trunk/com.aptana.rdt.ui/src/com/aptana/rdt/ui/AptanaRDTUIPlugin.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-25 15:10:19
|
Revision: 2840
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2840&view=rev
Author: cawilliams
Date: 2007-07-25 08:09:47 -0700 (Wed, 25 Jul 2007)
Log Message:
-----------
fix #5308 - Add new GEM_LIB loadpath variable. Now we can use that to resolve gem locations. This fixes the problem that we had with using RUBY_LIB as the variable - not all users have installs where the gems are a subdirectory of the ruby library folder.
This asks the gem manager to resolve the path to where gems get installed, then looks in there.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/plugin.xml
Modified: trunk/org.rubypeople.rdt.launching/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.launching/plugin.xml 2007-07-25 15:09:22 UTC (rev 2839)
+++ trunk/org.rubypeople.rdt.launching/plugin.xml 2007-07-25 15:09:47 UTC (rev 2840)
@@ -25,7 +25,7 @@
id="org.rubypeople.rdt.launching.LaunchConfigurationTypeRubyApplication">
</launchConfigurationType>
</extension>
- <extension
+ <extension
point="org.rubypeople.rdt.core.loadpathVariableInitializer">
<loadpathVariableInitializer
variable="RUBY_LIB"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-25 15:09:24
|
Revision: 2839
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2839&view=rev
Author: cawilliams
Date: 2007-07-25 08:09:22 -0700 (Wed, 25 Jul 2007)
Log Message:
-----------
fix #5308 - Add new GEM_LIB loadpath variable. Now we can use that to resolve gem locations. This fixes the problem that we had with using RUBY_LIB as the variable - not all users have installs where the gems are a subdirectory of the ruby library folder.
This asks the gem manager to resolve the path to where gems get installed, then looks in there.
Modified Paths:
--------------
trunk/com.aptana.rdt/META-INF/MANIFEST.MF
trunk/com.aptana.rdt/plugin.xml
Added Paths:
-----------
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/launching/
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/launching/GemLoadpathVariablesInitializer.java
trunk/com.aptana.rdt/src/com/aptana/rdt/launching/
trunk/com.aptana.rdt/src/com/aptana/rdt/launching/IGemRuntime.java
Modified: trunk/com.aptana.rdt/META-INF/MANIFEST.MF
===================================================================
--- trunk/com.aptana.rdt/META-INF/MANIFEST.MF 2007-07-25 15:08:33 UTC (rev 2838)
+++ trunk/com.aptana.rdt/META-INF/MANIFEST.MF 2007-07-25 15:09:22 UTC (rev 2839)
@@ -9,6 +9,7 @@
Bundle-Vendor: Aptana, Inc.
Export-Package: com.aptana.rdt,
com.aptana.rdt.core.gems,
+ com.aptana.rdt.launching,
com.aptana.rdt.internal.core.gems;x-friends:="com.aptana.rdt.tests",
com.aptana.rdt.internal.parser.warnings,
com.aptana.rdt.internal.ui.preferences
Modified: trunk/com.aptana.rdt/plugin.xml
===================================================================
--- trunk/com.aptana.rdt/plugin.xml 2007-07-25 15:08:33 UTC (rev 2838)
+++ trunk/com.aptana.rdt/plugin.xml 2007-07-25 15:09:22 UTC (rev 2839)
@@ -202,4 +202,12 @@
point="org.eclipse.ui.startup">
<startup class="com.aptana.rdt.internal.core.gems.RubyGemsInitializer"/>
</extension>
+
+ <extension
+ point="org.rubypeople.rdt.core.loadpathVariableInitializer">
+ <loadpathVariableInitializer
+ variable="GEM_LIB"
+ class="com.aptana.rdt.internal.launching.GemLoadpathVariablesInitializer">
+ </loadpathVariableInitializer>
+ </extension>
</plugin>
Added: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/launching/GemLoadpathVariablesInitializer.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/launching/GemLoadpathVariablesInitializer.java (rev 0)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/launching/GemLoadpathVariablesInitializer.java 2007-07-25 15:09:22 UTC (rev 2839)
@@ -0,0 +1,82 @@
+package com.aptana.rdt.internal.launching;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.rubypeople.rdt.core.LoadpathVariableInitializer;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.internal.launching.LaunchingPlugin;
+import org.rubypeople.rdt.launching.IVMInstall;
+import org.rubypeople.rdt.launching.RubyRuntime;
+
+import com.aptana.rdt.AptanaRDTPlugin;
+import com.aptana.rdt.core.gems.IGemManager;
+import com.aptana.rdt.launching.IGemRuntime;
+
+public class GemLoadpathVariablesInitializer extends LoadpathVariableInitializer {
+
+ private IProgressMonitor fMonitor;
+
+ @Override
+ public void initialize(String variable) {
+ IVMInstall vmInstall = RubyRuntime.getDefaultVMInstall();
+ if (vmInstall != null) {
+ IPath newPath = null;
+ IGemManager gemManager = AptanaRDTPlugin.getDefault().getGemManager();
+ IPath gemPath = gemManager.getGemInstallPath();
+ if (gemPath != null) {
+ if (variable.equals(IGemRuntime.GEMLIB_VARIABLE)) {
+ newPath = gemPath.append("gems");
+ }
+ if (newPath == null) {
+ return;
+ }
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceDescription wsDescription = workspace
+ .getDescription();
+ boolean wasAutobuild = wsDescription.isAutoBuilding();
+ try {
+ setAutobuild(workspace, false);
+ setRubyVMVariable(newPath, variable);
+ } catch (CoreException ce) {
+ LaunchingPlugin.log(ce);
+ return;
+ } finally {
+ try {
+ setAutobuild(workspace, wasAutobuild);
+ } catch (CoreException ce) {
+ LaunchingPlugin.log(ce);
+ }
+ }
+ }
+ }
+ }
+
+ private void setRubyVMVariable(IPath newPath, String var)
+ throws CoreException {
+ RubyCore.setLoadpathVariable(var, newPath, getMonitor());
+ }
+
+ private boolean setAutobuild(IWorkspace ws, boolean newState)
+ throws CoreException {
+ IWorkspaceDescription wsDescription = ws.getDescription();
+ boolean oldState = wsDescription.isAutoBuilding();
+ if (oldState != newState) {
+ wsDescription.setAutoBuilding(newState);
+ ws.setDescription(wsDescription);
+ }
+ return oldState;
+ }
+
+ protected IProgressMonitor getMonitor() {
+ if (fMonitor == null) {
+ return new NullProgressMonitor();
+ }
+ return fMonitor;
+ }
+
+}
Property changes on: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/launching/GemLoadpathVariablesInitializer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/com.aptana.rdt/src/com/aptana/rdt/launching/IGemRuntime.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/launching/IGemRuntime.java (rev 0)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/launching/IGemRuntime.java 2007-07-25 15:09:22 UTC (rev 2839)
@@ -0,0 +1,7 @@
+package com.aptana.rdt.launching;
+
+public interface IGemRuntime {
+
+ public static final String GEMLIB_VARIABLE = "GEM_LIB";
+
+}
Property changes on: trunk/com.aptana.rdt/src/com/aptana/rdt/launching/IGemRuntime.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-25 15:08:34
|
Revision: 2838
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2838&view=rev
Author: cawilliams
Date: 2007-07-25 08:08:33 -0700 (Wed, 25 Jul 2007)
Log Message:
-----------
fix #5308 - Add new GEM_LIB loadpath variable. Now we can use that to resolve gem locations. This fixes the problem that we had with using RUBY_LIB as the variable - not all users have installs where the gems are a subdirectory of the ruby library folder.
This asks the gem manager to resolve the path to where gems get installed, then looks in there.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewWizardMessages.properties
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/EditVariableEntryDialog.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewWizardMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewWizardMessages.properties 2007-07-25 14:27:05 UTC (rev 2837)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewWizardMessages.properties 2007-07-25 15:08:33 UTC (rev 2838)
@@ -307,11 +307,11 @@
EditVariableEntryDialog_extvardialog_description=Select JAR archive:
EditVariableEntryDialog_filename_error_notvalid=The archive path is not a valid path.
-EditVariableEntryDialog_filename_error_filenotexists=The path ''{0}'' does not point to an existing archive.
+EditVariableEntryDialog_filename_error_filenotexists=The path ''{0}'' does not point to an existing folder.
EditVariableEntryDialog_filename_error_varnotexists=Variable in the archive path does not exist.
EditVariableEntryDialog_filename_error_deviceinpath=The archive must be described by a variable path.
EditVariableEntryDialog_filename_warning_varempty=Archive variable path is empty.
-EditVariableEntryDialog_filename_error_alreadyexists=Classpath entry already exists.
+EditVariableEntryDialog_filename_error_alreadyexists=Loadpath entry already exists.
# ------- VariableBlock-------
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/EditVariableEntryDialog.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/EditVariableEntryDialog.java 2007-07-25 14:27:05 UTC (rev 2837)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/EditVariableEntryDialog.java 2007-07-25 15:08:33 UTC (rev 2838)
@@ -250,7 +250,7 @@
return status;
}
File file= resolvedPath.toFile();
- if (!file.isFile()) {
+ if (!file.isDirectory()) {
String message= Messages.format(NewWizardMessages.EditVariableEntryDialog_filename_error_filenotexists, resolvedPath.toOSString());
status.setInfo(message);
return status;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-25 14:27:12
|
Revision: 2837
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2837&view=rev
Author: cawilliams
Date: 2007-07-25 07:27:05 -0700 (Wed, 25 Jul 2007)
Log Message:
-----------
fix #5299 - Make gem loadpaths use variables that get resolved. Gem loadpaths now use the RUBY_LIB variable to make paths relative to the ruby library directory. This makes it so that oaths aren't absolute anymore and can be moved across workspaces/etc.
BUT, gems aren't always relative to the Ruby lib folder, so we really need to define a special GEM_LIB variable.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLoadpathVariablesInitializer.java
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLoadpathVariablesInitializer.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLoadpathVariablesInitializer.java 2007-07-25 14:26:59 UTC (rev 2836)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLoadpathVariablesInitializer.java 2007-07-25 14:27:05 UTC (rev 2837)
@@ -2,12 +2,16 @@
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.rubypeople.rdt.core.LoadpathVariableInitializer;
import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.launching.IVMInstall;
+import org.rubypeople.rdt.launching.RubyRuntime;
public class RubyLoadpathVariablesInitializer extends LoadpathVariableInitializer {
@@ -15,38 +19,36 @@
@Override
public void initialize(String variable) {
-// FIXME What should we be looking for?!
-// IVMInstall vmInstall= RubyRuntime.getDefaultVMInstall();
-// if (vmInstall != null) {
-// IPath newPath= null;
-// IPath[] locations= RubyRuntime.getLibraryLocations(vmInstall);
-//
-//
-// if (systemLib != null) {
-// if (variable.equals(RubyRuntime.RUBYLIB_VARIABLE)) {
-// newPath= systemLib;
-// }
-// if (newPath == null) {
-// return;
-// }
-// IWorkspace workspace= ResourcesPlugin.getWorkspace();
-// IWorkspaceDescription wsDescription= workspace.getDescription();
-// boolean wasAutobuild= wsDescription.isAutoBuilding();
-// try {
-// setAutobuild(workspace, false);
-// setRubyVMVariable(newPath, variable);
-// } catch (CoreException ce) {
-// LaunchingPlugin.log(ce);
-// return;
-// } finally {
-// try {
-// setAutobuild(workspace, wasAutobuild);
-// } catch (CoreException ce) {
-// LaunchingPlugin.log(ce);
-// }
-// }
-// }
-// }
+ IVMInstall vmInstall= RubyRuntime.getDefaultVMInstall();
+ if (vmInstall != null) {
+ IPath newPath= null;
+// IPath[] locations= RubyRuntime.getLibraryLocations(vmInstall);
+ IPath systemLib = new Path(vmInstall.getInstallLocation().getAbsolutePath()).append("lib");
+ if (systemLib != null) {
+ if (variable.equals(RubyRuntime.RUBYLIB_VARIABLE)) {
+ newPath= systemLib;
+ }
+ if (newPath == null) {
+ return;
+ }
+ IWorkspace workspace= ResourcesPlugin.getWorkspace();
+ IWorkspaceDescription wsDescription= workspace.getDescription();
+ boolean wasAutobuild= wsDescription.isAutoBuilding();
+ try {
+ setAutobuild(workspace, false);
+ setRubyVMVariable(newPath, variable);
+ } catch (CoreException ce) {
+ LaunchingPlugin.log(ce);
+ return;
+ } finally {
+ try {
+ setAutobuild(workspace, wasAutobuild);
+ } catch (CoreException ce) {
+ LaunchingPlugin.log(ce);
+ }
+ }
+ }
+ }
}
private void setRubyVMVariable(IPath newPath, String var) throws CoreException {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-25 14:27:00
|
Revision: 2836
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2836&view=rev
Author: cawilliams
Date: 2007-07-25 07:26:59 -0700 (Wed, 25 Jul 2007)
Log Message:
-----------
fix #5299 - Make gem loadpaths use variables that get resolved. Gem loadpaths now use the RUBY_LIB variable to make paths relative to the ruby library directory. This makes it so that oaths aren't absolute anymore and can be moved across workspaces/etc.
BUT, gems aren't always relative to the Ruby lib folder, so we really need to define a special GEM_LIB variable.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-07-25 14:26:45 UTC (rev 2835)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-07-25 14:26:59 UTC (rev 2836)
@@ -1477,4 +1477,18 @@
public static IRegion newRegion() {
return new Region();
}
+
+ /**
+ * Returns the names of all known loadpath variables.
+ * <p>
+ * Loadpath variable values are persisted locally to the workspace, and
+ * are preserved from session to session.
+ * <p>
+ *
+ * @return the list of loadpath variable names
+ * @see #setLoadpathVariable(String, IPath)
+ */
+ public static String[] getLoadpathVariableNames() {
+ return RubyModelManager.getRubyModelManager().variableNames();
+ }
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java 2007-07-25 14:26:45 UTC (rev 2835)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java 2007-07-25 14:26:59 UTC (rev 2836)
@@ -2953,4 +2953,15 @@
return VERBOSE;
}
+ public synchronized String[] variableNames(){
+ int length = this.variables.size();
+ String[] result = new String[length];
+ Iterator vars = this.variables.keySet().iterator();
+ int index = 0;
+ while (vars.hasNext()) {
+ result[index++] = (String) vars.next();
+ }
+ return result;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-25 14:26:46
|
Revision: 2835
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2835&view=rev
Author: cawilliams
Date: 2007-07-25 07:26:45 -0700 (Wed, 25 Jul 2007)
Log Message:
-----------
fix #5299 - Make gem loadpaths use variables that get resolved. Gem loadpaths now use the RUBY_LIB variable to make paths relative to the ruby library directory. This makes it so that oaths aren't absolute anymore and can be moved across workspaces/etc.
BUT, gems aren't always relative to the Ruby lib folder, so we really need to define a special GEM_LIB variable.
Modified Paths:
--------------
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/wizards/NewWizardMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/AddSourceFolderWizardPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/CPListElement.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/LibrariesWorkbookPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/PreferenceConstants.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/BuildPathDialogAccess.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/CPVariableElement.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/CPVariableElementLabelProvider.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/EditVariableEntryDialog.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/NewVariableEntryDialog.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/VariableBlock.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/VariableCreationDialog.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/VariablePathDialogField.java
Modified: 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 2007-07-24 17:31:10 UTC (rev 2834)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/NewRubyProjectPreferencePage.java 2007-07-25 14:26:45 UTC (rev 2835)
@@ -65,6 +65,7 @@
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.launching.RubyRuntime;
import org.rubypeople.rdt.ui.PreferenceConstants;
import org.rubypeople.rdt.ui.RubyUI;
@@ -273,11 +274,11 @@
}
private static ILoadpathEntry getJREContainerEntry() {
- return RubyCore.newContainerEntry(new Path("org.rubypeople.rdt.launching.RUBY_CONTAINER")); //$NON-NLS-1$
+ return RubyCore.newContainerEntry(new Path(RubyRuntime.RUBY_CONTAINER)); //$NON-NLS-1$
}
private static ILoadpathEntry getJREVariableEntry() {
- return RubyCore.newVariableEntry(new Path("RUBY_LIB")); //$NON-NLS-1$
+ return RubyCore.newVariableEntry(new Path(RubyRuntime.RUBYLIB_VARIABLE)); //$NON-NLS-1$
}
/*
Modified: 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.java 2007-07-24 17:31:10 UTC (rev 2834)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/NewWizardMessages.java 2007-07-25 14:26:45 UTC (rev 2835)
@@ -368,6 +368,57 @@
public static String SuperModuleSelectionDialog_addButton_label;
public static String SuperModuleSelectionDialog_interfaceadded_info;
public static String SuperModuleSelectionDialog_interfacealreadyadded_info;
+ public static String NewVariableEntryDialog_title;
+ public static String NewVariableEntryDialog_vars_extend;
+ public static String NewVariableEntryDialog_vars_label;
+ public static String NewVariableEntryDialog_configbutton_label;
+ public static String NewVariableEntryDialog_info_notexists;
+ public static String NewVariableEntryDialog_info_isfolder;
+ public static String NewVariableEntryDialog_info_noselection;
+ public static String NewVariableEntryDialog_info_selected;
+ public static String NewVariableEntryDialog_ExtensionDialog_title;
+ public static String NewVariableEntryDialog_ExtensionDialog_description;
+ public static String CPVariableElementLabelProvider_reserved;
+ public static String CPVariableElementLabelProvider_empty;
+ public static String EditVariableEntryDialog_title;
+ public static String EditVariableEntryDialog_filename_varlabel;
+ public static String EditVariableEntryDialog_filename_external_varbutton;
+ public static String EditVariableEntryDialog_filename_variable_button;
+ public static String EditVariableEntryDialog_extvardialog_title;
+ public static String EditVariableEntryDialog_extvardialog_description;
+ public static String EditVariableEntryDialog_filename_empty;
+ public static String EditVariableEntryDialog_filename_error_notvalid;
+ public static String EditVariableEntryDialog_filename_error_deviceinpath;
+ public static String EditVariableEntryDialog_filename_error_varnotexists;
+ public static String EditVariableEntryDialog_filename_warning_varempty;
+ public static String EditVariableEntryDialog_filename_error_filenotexists;
+ public static String EditVariableEntryDialog_filename_error_alreadyexists;
+ public static String VariablePathDialogField_variabledialog_title;
+ public static String VariableBlock_vars_add_button;
+ public static String VariableBlock_vars_edit_button;
+ public static String VariableBlock_vars_remove_button;
+ public static String VariableBlock_vars_label;
+ public static String VariableBlock_needsbuild_title;
+ public static String VariableBlock_needsbuild_message;
+ public static String VariableBlock_variableSettingError_titel;
+ public static String VariableBlock_variableSettingError_message;
+ public static String VariableBlock_operation_desc;
+ public static String VariableCreationDialog_titlenew;
+ public static String VariableCreationDialog_titleedit;
+ public static String VariableCreationDialog_name_label;
+ public static String VariableCreationDialog_path_label;
+ public static String VariableCreationDialog_path_file_button;
+ public static String VariableCreationDialog_path_dir_button;
+ public static String VariableCreationDialog_error_entername;
+ public static String VariableCreationDialog_error_whitespace;
+ public static String VariableCreationDialog_error_invalidname;
+ public static String VariableCreationDialog_error_nameexists;
+ public static String VariableCreationDialog_error_invalidpath;
+ public static String VariableCreationDialog_warning_pathnotexists;
+ public static String VariableCreationDialog_extjardialog_text;
+ public static String VariableCreationDialog_extdirdialog_text;
+ public static String VariableCreationDialog_extdirdialog_message;
+ public static String LibrariesWorkbookPage_libraries_addvariable_button;
static {
NLS.initializeMessages(BUNDLE_NAME, NewWizardMessages.class);
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/AddSourceFolderWizardPage.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/AddSourceFolderWizardPage.java 2007-07-24 17:31:10 UTC (rev 2834)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/AddSourceFolderWizardPage.java 2007-07-25 14:26:45 UTC (rev 2835)
@@ -198,7 +198,6 @@
private final IPath fOrginalPath;
private final boolean fLinkedMode;
- private IPath fNewOutputLocation;
private CPListElement fOldProjectSourceFolder;
private List fModifiedElements;
@@ -476,11 +475,9 @@
if (!fAllowConflict && fCanCommitConflictingBuildpath)
return new StatusInfo();
- fNewOutputLocation= null;
IRubyModelStatus status= RubyConventions.validateLoadpath(javaProject, CPListElement.convertToLoadpathEntries(fExistingEntries), null);
if (!status.isOK()) {
//Don't know what the problem is, report to user
- fNewOutputLocation= null;
if (fCanCommitConflictingBuildpath) {
result.setInfo(NewWizardMessages.AddSourceFolderWizardPage_conflictWarning + status.getMessage());
} else {
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/CPListElement.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/CPListElement.java 2007-07-24 17:31:10 UTC (rev 2834)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/CPListElement.java 2007-07-25 14:26:45 UTC (rev 2835)
@@ -439,17 +439,15 @@
case ILoadpathEntry.CPE_VARIABLE:
IPath resolvedPath= RubyCore.getResolvedVariablePath(path);
res= null;
- isMissing= root.findMember(resolvedPath) == null && !resolvedPath.toFile().isFile();
+ isMissing= !resolvedPath.toFile().isDirectory();
break;
case ILoadpathEntry.CPE_LIBRARY:
res= root.findMember(path);
if (res == null) {
-// if (!ArchiveFileFilter.isArchivePath(path)) {
- if (root.getWorkspace().validatePath(path.toString(), IResource.FOLDER).isOK()
- && root.getProject(path.segment(0)).exists()) {
- res= root.getFolder(path);
- }
-// }
+ if (root.getWorkspace().validatePath(path.toString(), IResource.FOLDER).isOK()
+ && root.getProject(path.segment(0)).exists()) {
+ res= root.getFolder(path);
+ }
isMissing= !path.toFile().isDirectory(); // look for external Folders
} else if (res.isLinked()) {
linkTarget= res.getLocation();
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/CPVariableElement.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/CPVariableElement.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/CPVariableElement.java 2007-07-25 14:26:45 UTC (rev 2835)
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * 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.wizards.buildpaths;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.util.Assert;
+
+
+public class CPVariableElement {
+
+ private String fName;
+ private IPath fPath;
+
+ private boolean fIsReserved;
+
+ public CPVariableElement(String name, IPath path, boolean reserved) {
+ Assert.isNotNull(name);
+ Assert.isNotNull(path);
+ fName= name;
+ fPath= path;
+ fIsReserved= reserved;
+ }
+
+ /**
+ * Gets the path
+ * @return Returns a IPath
+ */
+ public IPath getPath() {
+ return fPath;
+ }
+
+ /**
+ * Sets the path
+ * @param path The path to set
+ */
+ public void setPath(IPath path) {
+ fPath= path;
+ }
+
+ /**
+ * Gets the name
+ * @return Returns a String
+ */
+ public String getName() {
+ return fName;
+ }
+
+ /**
+ * Sets the name
+ * @param name The name to set
+ */
+ public void setName(String name) {
+ fName= name;
+ }
+
+ /*
+ * @see Object#equals()
+ */
+ public boolean equals(Object other) {
+ if (other != null && other.getClass().equals(getClass())) {
+ CPVariableElement elem= (CPVariableElement)other;
+ return fName.equals(elem.fName);
+ }
+ return false;
+ }
+
+ /*
+ * @see Object#hashCode()
+ */
+ public int hashCode() {
+ return fName.hashCode();
+ }
+
+ /**
+ * Returns true if variable is reserved
+ * @return Returns a boolean
+ */
+ public boolean isReserved() {
+ return fIsReserved;
+ }
+
+ /**
+ * Sets the isReserved
+ * @param isReserved The state to set
+ */
+ public void setReserved(boolean isReserved) {
+ fIsReserved= isReserved;
+ }
+
+
+}
Property changes on: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/CPVariableElement.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/CPVariableElementLabelProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/CPVariableElementLabelProvider.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/CPVariableElementLabelProvider.java 2007-07-25 14:26:45 UTC (rev 2835)
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * 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.wizards.buildpaths;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.viewers.IColorProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.RubyPluginImages;
+import org.rubypeople.rdt.internal.ui.wizards.NewWizardMessages;
+
+
+public class CPVariableElementLabelProvider extends LabelProvider implements IColorProvider {
+
+ private Image fJARImage;
+ private Image fFolderImage;
+ private boolean fShowResolvedVariables;
+
+ private Color fResolvedBackground;
+
+ public CPVariableElementLabelProvider(boolean showResolvedVariables) {
+ ImageRegistry reg= RubyPlugin.getDefault().getImageRegistry();
+ fJARImage= reg.get(RubyPluginImages.IMG_OBJS_EXTJAR);
+ fFolderImage= PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
+ fShowResolvedVariables= showResolvedVariables;
+ fResolvedBackground= null;
+ }
+
+ /*
+ * @see LabelProvider#getImage(java.lang.Object)
+ */
+ public Image getImage(Object element) {
+ if (element instanceof CPVariableElement) {
+ CPVariableElement curr= (CPVariableElement) element;
+ IPath path= curr.getPath();
+ if (path.toFile().isFile()) {
+ return fJARImage;
+ }
+ return fFolderImage;
+ }
+ return super.getImage(element);
+ }
+
+ /*
+ * @see LabelProvider#getText(java.lang.Object)
+ */
+ public String getText(Object element) {
+ if (element instanceof CPVariableElement) {
+ CPVariableElement curr= (CPVariableElement)element;
+ String name= curr.getName();
+ IPath path= curr.getPath();
+ StringBuffer buf= new StringBuffer(name);
+ if (curr.isReserved()) {
+ buf.append(' ');
+ buf.append(NewWizardMessages.CPVariableElementLabelProvider_reserved);
+ }
+ if (path != null) {
+ buf.append(" - "); //$NON-NLS-1$
+ if (!path.isEmpty()) {
+ buf.append(path.toOSString());
+ } else {
+ buf.append(NewWizardMessages.CPVariableElementLabelProvider_empty);
+ }
+ }
+ return buf.toString();
+ }
+
+
+ return super.getText(element);
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
+ */
+ public Color getForeground(Object element) {
+ return null;
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
+ */
+ public Color getBackground(Object element) {
+ if (element instanceof CPVariableElement) {
+ CPVariableElement curr= (CPVariableElement) element;
+ if (!fShowResolvedVariables && curr.isReserved()) {
+ if (fResolvedBackground == null) {
+ Display display= Display.getCurrent();
+ fResolvedBackground= display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
+ }
+ return fResolvedBackground;
+ }
+ }
+ return null;
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ */
+ public void dispose() {
+ super.dispose();
+ }
+
+}
Property changes on: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/CPVariableElementLabelProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/EditVariableEntryDialog.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/EditVariableEntryDialog.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/EditVariableEntryDialog.java 2007-07-25 14:26:45 UTC (rev 2835)
@@ -0,0 +1,299 @@
+/*******************************************************************************
+ * 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.wizards.buildpaths;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.StatusDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.internal.corext.util.Messages;
+import org.rubypeople.rdt.internal.ui.IRubyHelpContextIds;
+import org.rubypeople.rdt.internal.ui.dialogs.StatusInfo;
+import org.rubypeople.rdt.internal.ui.wizards.NewWizardMessages;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.DialogField;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.IStringButtonAdapter;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.LayoutUtil;
+
+/**
+ */
+public class EditVariableEntryDialog extends StatusDialog {
+
+ /**
+ * The path to which the archive variable points.
+ * Null if invalid path or not resolvable. Must not exist.
+ */
+ private IPath fFileVariablePath;
+
+ private IStatus fNameStatus;
+
+ private Set fExistingEntries;
+ private VariablePathDialogField fFileNameField;
+ private CLabel fFullPathResolvedLabel;
+
+ /**
+ * Constructor for EditVariableEntryDialog.
+ * @param parent
+ */
+ public EditVariableEntryDialog(Shell parent, IPath initialEntry, IPath[] existingEntries) {
+ super(parent);
+ setTitle(NewWizardMessages.EditVariableEntryDialog_title);
+
+ fExistingEntries= new HashSet();
+ if (existingEntries != null) {
+ for (int i = 0; i < existingEntries.length; i++) {
+ IPath curr= existingEntries[i];
+ if (!curr.equals(initialEntry)) {
+ fExistingEntries.add(curr);
+ }
+ }
+ }
+
+ SourceAttachmentAdapter adapter= new SourceAttachmentAdapter();
+
+ fFileNameField= new VariablePathDialogField(adapter);
+ fFileNameField.setDialogFieldListener(adapter);
+ fFileNameField.setLabelText(NewWizardMessages.EditVariableEntryDialog_filename_varlabel);
+ fFileNameField.setButtonLabel(NewWizardMessages.EditVariableEntryDialog_filename_external_varbutton);
+ fFileNameField.setVariableButtonLabel(NewWizardMessages.EditVariableEntryDialog_filename_variable_button);
+ String initialString= initialEntry != null ? initialEntry.toString() : ""; //$NON-NLS-1$
+ fFileNameField.setText(initialString);
+ }
+
+ public IPath getPath() {
+ return Path.fromOSString(fFileNameField.getText());
+ }
+
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createDialogArea(Composite parent) {
+ initializeDialogUnits(parent);
+ Composite composite= (Composite) super.createDialogArea(parent);
+
+ GridLayout layout= (GridLayout) composite.getLayout();
+ layout.numColumns= 3;
+
+ int widthHint= convertWidthInCharsToPixels(50);
+
+ GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ gd.horizontalSpan= 3;
+
+ // archive name field
+ fFileNameField.doFillIntoGrid(composite, 4);
+ LayoutUtil.setHorizontalSpan(fFileNameField.getLabelControl(null), 3);
+ LayoutUtil.setWidthHint(fFileNameField.getTextControl(null), widthHint);
+ LayoutUtil.setHorizontalGrabbing(fFileNameField.getTextControl(null));
+
+ // label that shows the resolved path for variable jars
+ //DialogField.createEmptySpace(composite, 1);
+ fFullPathResolvedLabel= new CLabel(composite, SWT.LEFT);
+ fFullPathResolvedLabel.setText(getResolvedLabelString());
+ fFullPathResolvedLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+ DialogField.createEmptySpace(composite, 2);
+
+
+ fFileNameField.postSetFocusOnDialogField(parent.getDisplay());
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IRubyHelpContextIds.SOURCE_ATTACHMENT_BLOCK);
+ applyDialogFont(composite);
+ return composite;
+ }
+
+ private class SourceAttachmentAdapter implements IStringButtonAdapter, IDialogFieldListener {
+
+ // -------- IStringButtonAdapter --------
+ public void changeControlPressed(DialogField field) {
+ attachmentChangeControlPressed(field);
+ }
+
+ // ---------- IDialogFieldListener --------
+ public void dialogFieldChanged(DialogField field) {
+ attachmentDialogFieldChanged(field);
+ }
+ }
+
+ private void attachmentChangeControlPressed(DialogField field) {
+// if (field == fFileNameField) {
+// IPath jarFilePath= chooseExtJarFile();
+// if (jarFilePath != null) {
+// fFileNameField.setText(jarFilePath.toString());
+// }
+// }
+ }
+
+ // ---------- IDialogFieldListener --------
+
+ private void attachmentDialogFieldChanged(DialogField field) {
+ if (field == fFileNameField) {
+ fNameStatus= updateFileNameStatus();
+ }
+ doStatusLineUpdate();
+ }
+
+
+// private IPath chooseExtJarFile() {
+// IPath currPath= getPath();
+// IPath resolvedPath= getResolvedPath(currPath);
+// File initialSelection= resolvedPath != null ? resolvedPath.toFile() : null;
+//
+// String currVariable= currPath.segment(0);
+// JARFileSelectionDialog dialog= new JARFileSelectionDialog(getShell(), false, false);
+// dialog.setTitle(NewWizardMessages.EditVariableEntryDialog_extvardialog_title);
+// dialog.setMessage(NewWizardMessages.EditVariableEntryDialog_extvardialog_description);
+// dialog.setInput(fFileVariablePath.toFile());
+// dialog.setInitialSelection(initialSelection);
+// if (dialog.open() == Window.OK) {
+// File result= (File) dialog.getResult()[0];
+// IPath returnPath= Path.fromOSString(result.getPath()).makeAbsolute();
+// return modifyPath(returnPath, currVariable);
+// }
+// return null;
+// }
+
+ private IPath getResolvedPath(IPath path) {
+ if (path != null) {
+ String varName= path.segment(0);
+ if (varName != null) {
+ IPath varPath= RubyCore.getLoadpathVariable(varName);
+ if (varPath != null) {
+ return varPath.append(path.removeFirstSegments(1));
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Takes a path and replaces the beginning with a variable name
+ * (if the beginning matches with the variables value)
+ */
+ private IPath modifyPath(IPath path, String varName) {
+ if (varName == null || path == null) {
+ return null;
+ }
+ if (path.isEmpty()) {
+ return new Path(varName);
+ }
+
+ IPath varPath= RubyCore.getLoadpathVariable(varName);
+ if (varPath != null) {
+ if (varPath.isPrefixOf(path)) {
+ path= path.removeFirstSegments(varPath.segmentCount());
+ } else {
+ path= new Path(path.lastSegment());
+ }
+ } else {
+ path= new Path(path.lastSegment());
+ }
+ return new Path(varName).append(path);
+ }
+
+ private IStatus updateFileNameStatus() {
+ StatusInfo status= new StatusInfo();
+ fFileVariablePath= null;
+
+ String fileName= fFileNameField.getText();
+ if (fileName.length() == 0) {
+ status.setError(NewWizardMessages.EditVariableEntryDialog_filename_empty);
+ return status;
+ } else {
+ if (!Path.EMPTY.isValidPath(fileName)) {
+ status.setError(NewWizardMessages.EditVariableEntryDialog_filename_error_notvalid);
+ return status;
+ }
+ IPath filePath= Path.fromOSString(fileName);
+ IPath resolvedPath;
+
+
+ if (filePath.getDevice() != null) {
+ status.setError(NewWizardMessages.EditVariableEntryDialog_filename_error_deviceinpath);
+ return status;
+ }
+ String varName= filePath.segment(0);
+ if (varName == null) {
+ status.setError(NewWizardMessages.EditVariableEntryDialog_filename_error_notvalid);
+ return status;
+ }
+ fFileVariablePath= RubyCore.getLoadpathVariable(varName);
+ if (fFileVariablePath == null) {
+ status.setError(NewWizardMessages.EditVariableEntryDialog_filename_error_varnotexists);
+ return status;
+ }
+ resolvedPath= fFileVariablePath.append(filePath.removeFirstSegments(1));
+
+ if (resolvedPath.isEmpty()) {
+ status.setWarning(NewWizardMessages.EditVariableEntryDialog_filename_warning_varempty);
+ return status;
+ }
+ File file= resolvedPath.toFile();
+ if (!file.isFile()) {
+ String message= Messages.format(NewWizardMessages.EditVariableEntryDialog_filename_error_filenotexists, resolvedPath.toOSString());
+ status.setInfo(message);
+ return status;
+ }
+ }
+ return status;
+ }
+
+ private String getResolvedLabelString() {
+ IPath resolvedPath= getResolvedPath(getPath());
+ if (resolvedPath != null) {
+ return resolvedPath.toOSString();
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ private boolean canBrowseFileName() {
+ // to browse with a variable JAR, the variable name must point to a directory
+ if (fFileVariablePath != null) {
+ return fFileVariablePath.toFile().isDirectory();
+ }
+ return false;
+ }
+
+ private void doStatusLineUpdate() {
+ fFileNameField.enableButton(canBrowseFileName());
+
+ // set the resolved path for variable jars
+ if (fFullPathResolvedLabel != null) {
+ fFullPathResolvedLabel.setText(getResolvedLabelString());
+ }
+
+ IStatus status= fNameStatus;
+ if (!status.matches(IStatus.ERROR)) {
+ IPath path= getPath();
+ if (fExistingEntries.contains(path)) {
+ String message= NewWizardMessages.EditVariableEntryDialog_filename_error_alreadyexists;
+ status= new StatusInfo(IStatus.ERROR, message);
+ }
+ }
+ updateStatus(status);
+ }
+
+
+
+}
Property changes on: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/EditVariableEntryDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/LibrariesWorkbookPage.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/LibrariesWorkbookPage.java 2007-07-24 17:31:10 UTC (rev 2834)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/LibrariesWorkbookPage.java 2007-07-25 14:26:45 UTC (rev 2835)
@@ -49,6 +49,7 @@
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
import org.rubypeople.rdt.core.ILoadpathEntry;
import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.internal.corext.util.Messages;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
import org.rubypeople.rdt.internal.ui.actions.WorkbenchRunnableAdapter;
@@ -74,8 +75,9 @@
private Control fSWTControl;
private final int IDX_ADDEXT= 0;
- private final int IDX_EDIT= 2;
- private final int IDX_REMOVE= 3;
+ private final int IDX_ADDVAR= 1;
+ private final int IDX_EDIT= 3;
+ private final int IDX_REMOVE= 4;
public LibrariesWorkbookPage(CheckedListDialogField classPathList, IWorkbenchPreferenceContainer pageContainer) {
fClassPathList= classPathList;
@@ -83,6 +85,7 @@
String[] buttonLabels= new String[] {
NewWizardMessages.LibrariesWorkbookPage_libraries_addextjar_button,
+ NewWizardMessages.LibrariesWorkbookPage_libraries_addvariable_button,
/* */ null,
NewWizardMessages.LibrariesWorkbookPage_libraries_edit_button,
NewWizardMessages.LibrariesWorkbookPage_libraries_remove_button,
@@ -201,6 +204,9 @@
case IDX_ADDEXT: /* add external folder */
libentries= openExtFolderDialog(null);
break;
+ case IDX_ADDVAR: /* add variable */
+ libentries= openVariableSelectionDialog(null);
+ break;
case IDX_EDIT: /* edit */
editEntry();
return;
@@ -384,6 +390,9 @@
}
}
break;
+ case ILoadpathEntry.CPE_VARIABLE:
+ res= openVariableSelectionDialog(elem);
+ break;
}
if (res != null && res.length > 0) {
CPListElement curr= res[0];
@@ -538,4 +547,39 @@
}
}
}
+
+ private CPListElement[] openVariableSelectionDialog(CPListElement existing) {
+ List existingElements= fLibrariesList.getElements();
+ ArrayList existingPaths= new ArrayList(existingElements.size());
+ for (int i= 0; i < existingElements.size(); i++) {
+ CPListElement elem= (CPListElement) existingElements.get(i);
+ if (elem.getEntryKind() == ILoadpathEntry.CPE_VARIABLE) {
+ existingPaths.add(elem.getPath());
+ }
+ }
+ IPath[] existingPathsArray= (IPath[]) existingPaths.toArray(new IPath[existingPaths.size()]);
+
+ if (existing == null) {
+ IPath[] paths= BuildPathDialogAccess.chooseVariableEntries(getShell(), existingPathsArray);
+ if (paths != null) {
+ ArrayList result= new ArrayList();
+ for (int i = 0; i < paths.length; i++) {
+ CPListElement elem= new CPListElement(fCurrJProject, ILoadpathEntry.CPE_VARIABLE, paths[i], null);
+ IPath resolvedPath= RubyCore.getResolvedVariablePath(paths[i]);
+ elem.setIsMissing((resolvedPath == null) || !resolvedPath.toFile().exists());
+ if (!existingElements.contains(elem)) {
+ result.add(elem);
+ }
+ }
+ return (CPListElement[]) result.toArray(new CPListElement[result.size()]);
+ }
+ } else {
+ IPath path= BuildPathDialogAccess.configureVariableEntry(getShell(), existing.getPath(), existingPathsArray);
+ if (path != null) {
+ CPListElement elem= new CPListElement(fCurrJProject, ILoadpathEntry.CPE_VARIABLE, path, null);
+ return new CPListElement[] { elem };
+ }
+ }
+ return null;
+ }
}
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/NewVariableEntryDialog.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/NewVariableEntryDialog.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/NewVariableEntryDialog.java 2007-07-25 14:26:45 UTC (rev 2835)
@@ -0,0 +1,292 @@
+/*******************************************************************************
+ * 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.wizards.buildpaths;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.StatusDialog;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.internal.corext.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.wizards.NewWizardMessages;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.DialogField;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.IListAdapter;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.LayoutUtil;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.ListDialogField;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField;
+
+public class NewVariableEntryDialog extends StatusDialog {
+
+ private class VariablesAdapter implements IDialogFieldListener, IListAdapter {
+
+ // -------- IListAdapter --------
+
+ public void customButtonPressed(ListDialogField field, int index) {
+ switch (index) {
+ case IDX_EXTEND: /* extend */
+ extendButtonPressed();
+ break;
+ }
+ }
+
+ public void selectionChanged(ListDialogField field) {
+ doSelectionChanged();
+ }
+
+ public void doubleClicked(ListDialogField field) {
+ doDoubleClick();
+ }
+
+ // ---------- IDialogFieldListener --------
+
+ public void dialogFieldChanged(DialogField field) {
+ if (field == fConfigButton) {
+ configButtonPressed();
+ }
+
+ }
+
+ }
+
+ private final int IDX_EXTEND= 0;
+
+ private ListDialogField fVariablesList;
+ private boolean fCanExtend;
+ private boolean fIsValidSelection;
+
+ private IPath[] fResultPaths;
+
+ private SelectionButtonDialogField fConfigButton;
+
+ public NewVariableEntryDialog(Shell parent) {
+ super(parent);
+ setTitle(NewWizardMessages.NewVariableEntryDialog_title);
+
+ int shellStyle= getShellStyle();
+ setShellStyle(shellStyle | SWT.MAX | SWT.RESIZE);
+ updateStatus(new StatusInfo(IStatus.ERROR, "")); //$NON-NLS-1$
+
+ String[] buttonLabels= new String[] {
+ NewWizardMessages.NewVariableEntryDialog_vars_extend,
+ };
+
+ VariablesAdapter adapter= new VariablesAdapter();
+
+ CPVariableElementLabelProvider labelProvider= new CPVariableElementLabelProvider(false);
+
+ fVariablesList= new ListDialogField(adapter, buttonLabels, labelProvider);
+ fVariablesList.setDialogFieldListener(adapter);
+ fVariablesList.setLabelText(NewWizardMessages.NewVariableEntryDialog_vars_label);
+
+ fVariablesList.enableButton(IDX_EXTEND, false);
+
+ fVariablesList.setViewerSorter(new ViewerSorter() {
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ if (e1 instanceof CPVariableElement && e2 instanceof CPVariableElement) {
+ return ((CPVariableElement)e1).getName().compareTo(((CPVariableElement)e2).getName());
+ }
+ return super.compare(viewer, e1, e2);
+ }
+ });
+
+
+ fConfigButton= new SelectionButtonDialogField(SWT.PUSH);
+ fConfigButton.setLabelText(NewWizardMessages.NewVariableEntryDialog_configbutton_label);
+ fConfigButton.setDialogFieldListener(adapter);
+
+ initializeElements();
+
+ fCanExtend= false;
+ fIsValidSelection= false;
+ fResultPaths= null;
+ }
+
+ private void initializeElements() {
+ String[] entries= RubyCore.getLoadpathVariableNames();
+ ArrayList elements= new ArrayList(entries.length);
+ for (int i= 0; i < entries.length; i++) {
+ String name= entries[i];
+ IPath entryPath= RubyCore.getLoadpathVariable(name);
+ if (entryPath != null) {
+ elements.add(new CPVariableElement(name, entryPath, false));
+ }
+ }
+
+ fVariablesList.setElements(elements);
+ }
+
+
+ /* (non-Rubydoc)
+ * @see Window#configureShell(Shell)
+ */
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, IRubyHelpContextIds.NEW_VARIABLE_ENTRY_DIALOG);
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jface.dialogs.Dialog#getDialogBoundsSettings()
+ */
+ protected IDialogSettings getDialogBoundsSettings() {
+ return RubyPlugin.getDefault().getDialogSettingsSection(getClass().getName());
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createDialogArea(Composite parent) {
+ initializeDialogUnits(parent);
+
+ Composite composite= (Composite) super.createDialogArea(parent);
+ GridLayout layout= (GridLayout) composite.getLayout();
+ layout.numColumns= 2;
+
+ fVariablesList.doFillIntoGrid(composite, 3);
+
+ LayoutUtil.setHorizontalSpan(fVariablesList.getLabelControl(null), 2);
+
+ GridData listData= (GridData) fVariablesList.getListControl(null).getLayoutData();
+ listData.grabExcessHorizontalSpace= true;
+ listData.heightHint= convertHeightInCharsToPixels(10);
+ listData.widthHint= convertWidthInCharsToPixels(70);
+
+ Composite lowerComposite= new Composite(composite, SWT.NONE);
+ lowerComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+
+ layout= new GridLayout();
+ layout.marginHeight= 0;
+ layout.marginWidth= 0;
+ lowerComposite.setLayout(layout);
+
+ fConfigButton.doFillIntoGrid(lowerComposite, 1);
+
+ applyDialogFont(composite);
+ return composite;
+ }
+
+ public IPath[] getResult() {
+ return fResultPaths;
+ }
+
+ /*
+ * @see IDoubleClickListener#doubleClick(DoubleClickEvent)
+ */
+ private void doDoubleClick() {
+ if (fIsValidSelection) {
+ okPressed();
+ } else if (fCanExtend) {
+ extendButtonPressed();
+ }
+ }
+
+ private void doSelectionChanged() {
+ boolean isValidSelection= true;
+ boolean canExtend= false;
+ StatusInfo status= new StatusInfo();
+
+ List selected= fVariablesList.getSelectedElements();
+ int nSelected= selected.size();
+
+ if (nSelected > 0) {
+ fResultPaths= new Path[nSelected];
+ for (int i= 0; i < nSelected; i++) {
+ CPVariableElement curr= (CPVariableElement) selected.get(i);
+ fResultPaths[i]= new Path(curr.getName());
+ File file= curr.getPath().toFile();
+ if (!file.exists()) {
+ status.setError(NewWizardMessages.NewVariableEntryDialog_info_notexists);
+ isValidSelection= false;
+ break;
+ }
+ if (file.isDirectory()) {
+ status.setError(NewWizardMessages.NewVariableEntryDialog_info_isfolder);
+ canExtend= true;
+ isValidSelection= false;
+ break;
+ }
+ }
+ } else {
+ isValidSelection= false;
+ status.setInfo(NewWizardMessages.NewVariableEntryDialog_info_noselection);
+ }
+ if (isValidSelection && nSelected > 1) {
+ String str= Messages.format(NewWizardMessages.NewVariableEntryDialog_info_selected, String.valueOf(nSelected));
+ status.setInfo(str);
+ }
+ fCanExtend= nSelected == 1 && canExtend;
+ fVariablesList.enableButton(0, fCanExtend);
+
+ updateStatus(status);
+ fIsValidSelection= isValidSelection;
+ Button okButton= getButton(IDialogConstants.OK_ID);
+ if (okButton != null && !okButton.isDisposed()) {
+ okButton.setEnabled(isValidSelection);
+ }
+ }
+
+ private IPath[] chooseExtensions(CPVariableElement elem) {
+ File file= elem.getPath().toFile();
+ DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.OPEN);
+ dialog.setText(NewWizardMessages.NewVariableEntryDialog_ExtensionDialog_title);
+ dialog.setMessage(Messages.format(NewWizardMessages.NewVariableEntryDialog_ExtensionDialog_description, elem.getName()));
+ dialog.setFilterPath(file.toString());
+ String filename = null;
+ if ((filename = dialog.open()) != null) {
+ File myFile = new File(filename);
+ IPath filePath= Path.fromOSString(myFile.getPath());
+ IPath resPath= new Path(elem.getName());
+ for (int k= elem.getPath().segmentCount(); k < filePath.segmentCount(); k++) {
+ resPath= resPath.append(filePath.segment(k));
+ }
+ return new IPath[] { resPath };
+ }
+ return null;
+ }
+
+ protected final void extendButtonPressed() {
+ List selected= fVariablesList.getSelectedElements();
+ if (selected.size() == 1) {
+ IPath[] extendedPaths= chooseExtensions((CPVariableElement) selected.get(0));
+ if (extendedPaths != null) {
+ fResultPaths= extendedPaths;
+ super.buttonPressed(IDialogConstants.OK_ID);
+ }
+ }
+ }
+
+ protected final void configButtonPressed() {
+// String id= LoadpathVariablesPreferencePage.ID; FIXME Uncomment this
+// PreferencesUtil.createPreferenceDialogOn(getShell(), id, new String[] { id }, null).open();
+ initializeElements();
+ }
+
+}
Property changes on: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/NewVariableEntryDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/VariableBlock.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/VariableBlock.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/VariableBlock.java 2007-07-25 14:26:45 UTC (rev 2835)
@@ -0,0 +1,428 @@
+/*******************************************************************************
+ * 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.wizards.buildpaths;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.rubypeople.rdt.core.ILoadpathEntry;
+import org.rubypeople.rdt.core.IRubyModel;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.util.CoreUtility;
+import org.rubypeople.rdt.internal.ui.util.ExceptionHandler;
+import org.rubypeople.rdt.internal.ui.wizards.NewWizardMessages;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.DialogField;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.IListAdapter;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.LayoutUtil;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.ListDialogField;
+import org.rubypeople.rdt.launching.RubyRuntime;
+
+
+public class VariableBlock {
+
+ private ListDialogField fVariablesList;
+ private Control fControl;
+ private boolean fHasChanges;
+
+ private List fSelectedElements;
+ private boolean fAskToBuild;
+ private boolean fInPreferencePage;
+
+
+ /**
+ * Constructor for VariableBlock
+ */
+ public VariableBlock(boolean inPreferencePage, String initSelection) {
+
+ fSelectedElements= new ArrayList(0);
+ fInPreferencePage= inPreferencePage;
+ fAskToBuild= true;
+
+ String[] buttonLabels= new String[] {
+ NewWizardMessages.VariableBlock_vars_add_button,
+ NewWizardMessages.VariableBlock_vars_edit_button,
+ NewWizardMessages.VariableBlock_vars_remove_button
+ };
+
+ VariablesAdapter adapter= new VariablesAdapter();
+
+ CPVariableElementLabelProvider labelProvider= new CPVariableElementLabelProvider(!inPreferencePage);
+
+ fVariablesList= new ListDialogField(adapter, buttonLabels, labelProvider);
+ fVariablesList.setDialogFieldListener(adapter);
+ fVariablesList.setLabelText(NewWizardMessages.VariableBlock_vars_label);
+ fVariablesList.setRemoveButtonIndex(2);
+
+ fVariablesList.enableButton(1, false);
+
+ fVariablesList.setViewerSorter(new ViewerSorter() {
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ if (e1 instanceof CPVariableElement && e2 instanceof CPVariableElement) {
+ return ((CPVariableElement)e1).getName().compareTo(((CPVariableElement)e2).getName());
+ }
+ return super.compare(viewer, e1, e2);
+ }
+ });
+ refresh(initSelection);
+ }
+
+ public boolean hasChanges() {
+ return fHasChanges;
+ }
+
+ public void setChanges(boolean hasChanges) {
+ fHasChanges= hasChanges;
+ }
+
+
+ private String[] getReservedVariableNames() {
+ return new String[] {
+ RubyRuntime.RUBYLIB_VARIABLE
+ };
+ }
+
+ public Control createContents(Composite parent) {
+ Composite composite= new Composite(parent, SWT.NONE);
+ composite.setFont(parent.getFont());
+
+ LayoutUtil.doDefaultLayout(composite, new DialogField[] { fVariablesList }, true, 0, 0);
+ LayoutUtil.setHorizontalGrabbing(fVariablesList.getListControl(null));
+
+ fControl= composite;
+ return composite;
+ }
+
+ public void addDoubleClickListener(IDoubleClickListener listener) {
+ fVariablesList.getTableViewer().addDoubleClickListener(listener);
+ }
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ fVariablesList.getTableViewer().addSelectionChangedListener(listener);
+ }
+
+
+ private Shell getShell() {
+ if (fControl != null) {
+ return fControl.getShell();
+ }
+ return RubyPlugin.getActiveWorkbenchShell();
+ }
+
+ private class VariablesAdapter implements IDialogFieldListener, IListAdapter {
+
+ // -------- IListAdapter --------
+
+ public void customButtonPressed(ListDialogField field, int index) {
+ switch (index) {
+ case 0: /* add */
+ editEntries(null);
+ break;
+ case 1: /* edit */
+ List selected= field.getSelectedElements();
+ editEntries((CPVariableElement)selected.get(0));
+ break;
+ }
+ }
+
+ public void selectionChanged(ListDialogField field) {
+ doSelectionChanged(field);
+ }
+
+ public void doubleClicked(ListDialogField field) {
+ if (fInPreferencePage) {
+ List selected= field.getSelectedElements();
+ if (canEdit(selected, containsReserved(selected))) {
+ editEntries((CPVariableElement) selected.get(0));
+ }
+ }
+ }
+
+ // ---------- IDialogFieldListener --------
+
+ public void dialogFieldChanged(DialogField field) {
+ }
+
+ }
+
+ private boolean containsReserved(List selected) {
+ for (int i= selected.size()-1; i >= 0; i--) {
+ if (((CPVariableElement)selected.get(i)).isReserved()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static void addAll(Object[] objs, Collection dest) {
+ for (int i= 0; i < objs.length; i++) {
+ dest.add(objs[i]);
+ }
+ }
+
+ private boolean canEdit(List selected, boolean containsReserved) {
+ return selected.size() == 1 && !containsReserved;
+ }
+
+ private void doSelectionChanged(DialogField field) {
+ List selected= fVariablesList.getSelectedElements();
+ boolean containsReserved= containsReserved(selected);
+
+ // edit
+ fVariablesList.enableButton(1, canEdit(selected, containsReserved));
+ // remove button
+ fVariablesList.enableButton(2, !containsReserved);
+
+ fSelectedElements= selected;
+ }
+
+ private void editEntries(CPVariableElement entry) {
+ List existingEntries= fVariablesList.getElements();
+
+ VariableCreationDialog dialog= new VariableCreationDialog(getShell(), entry, existingEntries);
+ if (dialog.open() != Window.OK) {
+ return;
+ }
+ CPVariableElement newEntry= dialog.getClasspathElement();
+ if (entry == null) {
+ fVariablesList.addElement(newEntry);
+ entry= newEntry;
+ fHasChanges= true;
+ } else {
+ boolean hasChanges= !(entry.getName().equals(newEntry.getName()) && entry.getPath().equals(newEntry.getPath()));
+ if (hasChanges) {
+ fHasChanges= true;
+ entry.setName(newEntry.getName());
+ entry.setPath(newEntry.getPath());
+ fVariablesList.refresh();
+ }
+ }
+ fVariablesList.selectElements(new StructuredSelection(entry));
+ }
+
+ public List getSelectedElements() {
+ return fSelectedElements;
+ }
+
+
+ public void performDefaults() {
+ fVariablesList.removeAllElements();
+ String[] reservedName= getReservedVariableNames();
+ for (int i= 0; i < reservedName.length; i++) {
+ CPVariableElement elem= new CPVariableElement(reservedName[i], Path.EMPTY, true);
+ elem.setReserved(true);
+ fVariablesList.addElement(elem);
+ }
+ fHasChanges= true;
+ }
+
+ public boolean performOk() {
+ ArrayList removedVariables= new ArrayList();
+ ArrayList changedVariables= new ArrayList();
+ removedVariables.addAll(Arrays.asList(RubyCore.getLoadpathVariableNames()));
+
+ // remove all unchanged
+ List changedElements= fVariablesList.getElements();
+ for (int i= changedElements.size()-1; i >= 0; i--) {
+ CPVariableElement curr= (CPVariableElement) changedElements.get(i);
+ if (curr.isReserved()) {
+ changedElements.remove(curr);
+ } else {
+ IPath path= curr.getPath();
+ IPath prevPath= RubyCore.getLoadpathVariable(curr.getName());
+ if (prevPath != null && prevPath.equals(path)) {
+ changedElements.remove(curr);
+ } else {
+ changedVariables.add(curr.getName());
+ }
+ }
+ removedVariables.remove(curr.getName());
+ }
+ int steps= changedElements.size() + removedVariables.size();
+ if (steps > 0) {
+
+ boolean needsBuild= false;
+ if (fAskToBuild && doesChangeRequireFullBuild(removedVariables, changedVariables)) {
+ String title= NewWizardMessages.VariableBlock_needsbuild_title;
+ String message= NewWizardMessages.VariableBlock_needsbuild_message;
+
+ MessageDialog buildDialog= new MessageDialog(getShell(), title, null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 2);
+ int res= buildDialog.open();
+ if (res != 0 && res != 1) {
+ return false;
+ }
+ needsBuild= (res == 0);
+ }
+
+ final VariableBlockRunnable runnable= new VariableBlockRunnable(removedVariables, changedElements);
+ final ProgressMonitorDialog dialog= new ProgressMonitorDialog(getShell());
+ try {
+ dialog.run(true, true, runnable);
+ } catch (InvocationTargetException e) {
+ ExceptionHandler.handle(new InvocationTargetException(new NullPointerException()), getShell(), NewWizardMessages.VariableBlock_variableSettingError_titel, NewWizardMessages.VariableBlock_variableSettingError_message);
+ return false;
+ } catch (InterruptedException e) {
+ return false;
+ }
+
+ if (needsBuild) {
+ CoreUtility.getBuildJob(null).schedule();
+ }
+ }
+ return true;
+ }
+
+ private boolean doesChangeRequireFullBuild(List removed, List changed) {
+ try {
+ IRubyModel model= RubyCore.create(ResourcesPlugin.getWorkspace().getRoot());
+ IRubyProject[] projects= model.getRubyProjects();
+ for (int i= 0; i < projects.length; i++) {
+ ILoadpathEntry[] entries= projects[i].getRawLoadpath();
+ for (int k= 0; k < entries.length; k++) {
+ ILoadpathEntry curr= entries[k];
+ if (curr.getEntryKind() == ILoadpathEntry.CPE_VARIABLE) {
+ String var= curr.getPath().segment(0);
+ if (removed.contains(var) || changed.contains(var)) {
+ return true;
+ }
+ }
+ }
+ }
+ } catch (RubyModelException e) {
+ return true;
+ }
+ return false;
+ }
+
+ private class VariableBlockRunnable implements IRunnableWithProgress {
+ private List fToRemove;
+ private List fToChange;
+
+ public VariableBlockRunnable(List toRemove, List toChange) {
+ fToRemove= toRemove;
+ fToChange= toChange;
+ }
+
+ /*
+ * @see IRunnableWithProgress#run(IProgressMonitor)
+ */
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ monitor.beginTask(NewWizardMessages.VariableBlock_operation_desc, 1);
+ try {
+ setVariables(monitor);
+
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ } catch (OperationCanceledException e) {
+ throw new InterruptedException();
+ } finally {
+ monitor.done();
+ }
+ }
+
+ public void setVariables(IProgressMonitor monitor) throws RubyModelException, CoreException {
+ int nVariables= fToChange.size() + fToRemove.size();
+
+ String[] names= new String[nVariables];
+ IPath[] paths= new IPath[nVariables];
+ int k= 0;
+
+ for (int i= 0; i < fToChange.size(); i++) {
+ CPVariableElement curr= (CPVariableElement) fToChange.get(i);
+ names[k]= curr.getName();
+ paths[k]= curr.getPath();
+ k++;
+ }
+ for (int i= 0; i < fToRemove.size(); i++) {
+ names[k]= (String) fToRemove.get(i);
+ paths[k]= null;
+ k++;
+ }
+ RubyCore.setLoadpathVariables(names, paths, new SubProgressMonitor(monitor, 1));
+ }
+ }
+
+ /**
+ * If set to true, a dialog will ask the user to build on variable changed
+ * @param askToBuild The askToBuild to set
+ */
+ public void setAskToBuild(boolean askToBuild) {
+ fAskToBuild= askToBuild;
+ }
+
+ /**
+ *
+ */
+ public void refresh(String initSelection) {
+ CPVariableElement initSelectedElement= null;
+
+ String[] reservedName= getReservedVariableNames();
+ ArrayList reserved= new ArrayList(reservedName.length);
+ addAll(reservedName, reserved);
+
+ String[] entries= RubyCore.getLoadpathVariableNames();
+ ArrayList elements= new ArrayList(entries.length);
+ for (int i= 0; i < entries.length; i++) {
+ String name= entries[i];
+ CPVariableElement elem;
+ IPath entryPath= RubyCore.getLoadpathVariable(name);
+ if (entryPath != null) {
+ elem= new CPVariableElement(name, entryPath, reserved.contains(name));
+ elements.add(elem);
+ if (name.equals(initSelection)) {
+ initSelectedElement= elem;
+ }
+ } else {
+ RubyPlugin.logErrorMessage("VariableBlock: Loadpath variable with null value: " + name); //$NON-NLS-1$
+ }
+ }
+
+ fVariablesList.setElements(elements);
+
+ if (initSelectedElement != null) {
+ ISelection sel= new StructuredSelection(initSelectedElement);
+ fVariablesList.selectElements(sel);
+ } else {
+ fVariablesList.selectFirstElement();
+ }
+
+ fHasChanges= false;
+ }
+
+}
Property changes on: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/VariableBlock.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/VariableCreationDialog.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/VariableCreationDialog.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/buildpaths/VariableCreationDialog.java 2007-07-25 14:26:45 UTC (rev 2835)
@@ -0,0 +1,284 @@
+/*******************************************************************************
+ * 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.wizards.buildpaths;
+
+import java.io.File;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.StatusDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.rubypeople.rdt.internal.ui.IRubyHelpContextIds;
+import org.rubypeople.rdt.internal.ui.IUIConstants;
+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.internal.ui.wizards.NewWizardMessages;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.DialogField;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.IStringButtonAdapter;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.LayoutUtil;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.StringButtonDialogField;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.StringDialogField;
+
+public class VariableCreationDialog extends StatusDialog {
+
+ private IDialogSettings fDialogSettings;
+ ...
[truncated message content] |
|
From: <caw...@us...> - 2007-07-24 17:31:12
|
Revision: 2834
http://svn.sourceforge.net/rubyeclipse/?rev=2834&view=rev
Author: cawilliams
Date: 2007-07-24 10:31:10 -0700 (Tue, 24 Jul 2007)
Log Message:
-----------
fix #5141 - Ruby Class Wizard folder/source root folder fields are confusing. Combine the two dialog fields into one. Now user just selects the ultimate folder they want the type/test placed into.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/wizards/RubyNewTestCaseWizardPage.java
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/wizards/RubyNewTestCaseWizardPage.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/wizards/RubyNewTestCaseWizardPage.java 2007-07-24 17:31:04 UTC (rev 2833)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/wizards/RubyNewTestCaseWizardPage.java 2007-07-24 17:31:10 UTC (rev 2834)
@@ -24,7 +24,7 @@
import org.eclipse.swt.widgets.Text;
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.IRubyProject;
-import org.rubypeople.rdt.core.ISourceFolderRoot;
+import org.rubypeople.rdt.core.ISourceFolder;
import org.rubypeople.rdt.core.IType;
import org.rubypeople.rdt.core.RubyConventions;
import org.rubypeople.rdt.core.RubyModelException;
@@ -106,7 +106,7 @@
container.setLayout(layout);
createContainerControls(container, nColumns);
- createPackageControls(container, nColumns);
+// createPackageControls(container, nColumns);
createSeparator(container, nColumns);
createTypeNameControls(container, nColumns);
createSuperClassControls(container, nColumns);
@@ -261,7 +261,7 @@
}
private IType chooseClassToTestType() {
- ISourceFolderRoot root= getSourceFolderRoot();
+ ISourceFolder root= getSourceFolder();
if (root == null) {
return null;
}
@@ -321,7 +321,7 @@
fClassUnderTest= null;
- ISourceFolderRoot root = getSourceFolderRoot();
+ ISourceFolder root = getSourceFolder();
if (root == null) {
return status;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-24 17:31:07
|
Revision: 2833
http://svn.sourceforge.net/rubyeclipse/?rev=2833&view=rev
Author: cawilliams
Date: 2007-07-24 10:31:04 -0700 (Tue, 24 Jul 2007)
Log Message:
-----------
fix #5141 - Ruby Class Wizard folder/source root folder fields are confusing. Combine the two dialog fields into one. Now user just selects the ultimate folder they want the type/test placed into.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceFolderRootInfo.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceFolderRootInfo.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceFolderRootInfo.java 2007-07-24 17:30:58 UTC (rev 2832)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceFolderRootInfo.java 2007-07-24 17:31:04 UTC (rev 2833)
@@ -96,7 +96,8 @@
int nonJavaResourcesCounter = 0;
try {
ILoadpathEntry[] classpath = project.getResolvedLoadpath(true/*ignoreUnresolvedEntry*/, false/*don't generateMarkerOnError*/, false/*don't returnResolutionInProgress*/);
- IResource[] members = folder.members();
+ IResource[] members = new IResource[0];
+ if (folder != null) members = folder.members();
nextResource: for (int i = 0, max = members.length; i < max; i++) {
IResource member = members[i];
switch (member.getType()) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-24 17:31:02
|
Revision: 2832
http://svn.sourceforge.net/rubyeclipse/?rev=2832&view=rev
Author: cawilliams
Date: 2007-07-24 10:30:58 -0700 (Tue, 24 Jul 2007)
Log Message:
-----------
fix #5141 - Ruby Class Wizard folder/source root folder fields are confusing. Combine the two dialog fields into one. Now user just selects the ultimate folder they want the type/test placed into.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/RubyModelUtil.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/StandardRubyElementContentProvider.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewClassWizardPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewContainerWizardPage.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewTypeWizardPage.java
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-07-24 15:29:07 UTC (rev 2831)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/RubyModelUtil.java 2007-07-24 17:30:58 UTC (rev 2832)
@@ -78,6 +78,10 @@
public static ISourceFolderRoot getSourceFolderRoot(IRubyElement element) {
return (ISourceFolderRoot) element.getAncestor(IRubyElement.SOURCE_FOLDER_ROOT);
}
+
+ public static ISourceFolder getSourceFolder(IRubyElement element) {
+ return (ISourceFolder) element.getAncestor(IRubyElement.SOURCE_FOLDER);
+ }
public static boolean isExcludedPath(IPath resourcePath, IPath[] exclusionPatterns) {
char[] path = resourcePath.toString().toCharArray();
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/StandardRubyElementContentProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/StandardRubyElementContentProvider.java 2007-07-24 15:29:07 UTC (rev 2831)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/StandardRubyElementContentProvider.java 2007-07-24 17:30:58 UTC (rev 2832)
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.rubypeople.rdt.ui;
+import java.io.File;
import java.util.ArrayList;
import java.util.List;
@@ -193,6 +194,17 @@
private Object[] getSourceFolders(ISourceFolderRoot root) throws RubyModelException {
IRubyElement[] fragments= root.getChildren();
+ List<IRubyElement> list = new ArrayList<IRubyElement>();
+ for (int i = 0; i < fragments.length; i++) {
+ if (!(fragments[i] instanceof ISourceFolder)) continue;
+ ISourceFolder folder = (ISourceFolder) fragments[i];
+ if (folder.isDefaultPackage()) continue;
+ String name = folder.getElementName();
+ int index = name.indexOf(File.separatorChar);
+ if (index == -1) list.add(folder);
+ }
+ fragments = new IRubyElement[list.size()];
+ fragments = list.toArray(fragments);
Object[] nonRubyResources= root.getNonRubyResources();
if (nonRubyResources == null)
return fragments;
@@ -210,7 +222,7 @@
for (int i= 0; i < roots.length; i++) {
ISourceFolderRoot root= roots[i];
if (isProjectSourceFolderRoot(root)) {
- Object[] children= root.getChildren();
+ Object[] children= getChildren(root);
for (int k= 0; k < children.length; k++)
list.add(children[k]);
}
@@ -230,7 +242,21 @@
}
private Object[] getFoldersAndRubyScripts(ISourceFolder folder) throws RubyModelException {
- return concatenate(folder.getRubyScripts(), folder.getNonRubyResources());
+ ISourceFolderRoot root = (ISourceFolderRoot) folder.getParent();
+ IRubyElement[] children = root.getChildren();
+ List<IRubyElement> list = new ArrayList<IRubyElement>();
+ for (int i = 0; i < children.length; i++) {
+ if (children[i].equals(folder)) continue;
+ if (!children[i].getElementName().startsWith(folder.getElementName())) continue;
+ String name = children[i].getElementName();
+ name = name.substring(folder.getElementName().length() + 1);
+ int index = name.indexOf(File.separator);
+ if (index != -1) continue;
+ list.add(children[i]);
+ }
+ IRubyElement[] folders = new IRubyElement[list.size()];
+ folders = list.toArray(folders);
+ return concatenate(folders, concatenate(folder.getRubyScripts(), folder.getNonRubyResources()));
}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewClassWizardPage.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewClassWizardPage.java 2007-07-24 15:29:07 UTC (rev 2831)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewClassWizardPage.java 2007-07-24 17:30:58 UTC (rev 2832)
@@ -111,7 +111,7 @@
// pick & choose the wanted UI components
createContainerControls(composite, nColumns);
- createPackageControls(composite, nColumns);
+// createPackageControls(composite, nColumns);
// createEnclosingTypeControls(composite, nColumns);
createSeparator(composite, nColumns);
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewContainerWizardPage.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewContainerWizardPage.java 2007-07-24 15:29:07 UTC (rev 2831)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewContainerWizardPage.java 2007-07-24 17:30:58 UTC (rev 2832)
@@ -25,6 +25,7 @@
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.IRubyModel;
import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.core.ISourceFolder;
import org.rubypeople.rdt.core.ISourceFolderRoot;
import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.core.RubyModelException;
@@ -55,7 +56,7 @@
private IWorkspaceRoot fWorkspaceRoot;
private StringButtonDialogField fContainerDialogField;
- private ISourceFolderRoot fCurrRoot;
+ private ISourceFolder fCurrSourceFolder;
/**
* Create a new <code>NewContainerWizardPage</code>
@@ -74,7 +75,7 @@
fContainerDialogField.setButtonLabel(NewWizardMessages.NewContainerWizardPage_container_button);
fContainerStatus= new StatusInfo();
- fCurrRoot= null;
+ fCurrSourceFolder= null;
}
/**
@@ -202,9 +203,9 @@
private void containerChangeControlPressed(DialogField field) {
// take the current rproject as init element of the dialog
- ISourceFolderRoot root= chooseContainer();
+ ISourceFolder root= chooseContainer();
if (root != null) {
- setSourceFolderRoot(root, true);
+ setSourceFolder(root, true);
}
}
@@ -222,7 +223,7 @@
*
* @return the text of the source folder text field
*/
- public String getSourceFolderRootText() {
+ public String getSourceFolderText() {
return fContainerDialogField.getText();
}
@@ -237,8 +238,8 @@
protected IStatus containerChanged() {
StatusInfo status= new StatusInfo();
- fCurrRoot= null;
- String str= getSourceFolderRootText();
+ fCurrSourceFolder= null;
+ String str= getSourceFolderText();
if (str.length() == 0) {
status.setError(NewWizardMessages.NewContainerWizardPage_error_EnterContainerName);
return status;
@@ -254,7 +255,8 @@
return status;
}
IRubyProject rproject= RubyCore.create(proj);
- fCurrRoot= rproject.getSourceFolderRoot(res);
+ IRubyElement element = RubyCore.create(res);
+ fCurrSourceFolder= RubyModelUtil.getSourceFolder(element);
if (res.exists()) {
try {
if (!proj.hasNature(RubyCore.NATURE_ID)) {
@@ -265,7 +267,7 @@
}
return status;
}
- if (!rproject.isOnLoadpath(fCurrRoot)) {
+ if (!rproject.isOnLoadpath(fCurrSourceFolder)) {
status.setWarning(Messages.format(NewWizardMessages.NewContainerWizardPage_warning_NotOnLoadPath, str));
}
} catch (CoreException e) {
@@ -284,14 +286,49 @@
}
/**
+ * A hook method that gets called when the package field has changed. The method
+ * validates the package name and returns the status of the validation. The validation
+ * also updates the package fragment model.
+ * <p>
+ * Subclasses may extend this method to perform their own validation.
+ * </p>
+ *
+ * @return the status of the validation
+ */
+// protected IStatus packageChanged() { FIXME Combine this with chooseContainer to properly validate the selection
+// StatusInfo status= new StatusInfo();
+// fSourceFolderDialogField.enableButton(getSourceFolderRoot() != null);
+//
+// String packName= getPackageText();
+// if (packName.length() > 0) {
+// IStatus val= RubyConventions.validateSourceFolderName(packName);
+// if (val.getSeverity() == IStatus.ERROR) {
+// status.setError(Messages.format(NewWizardMessages.NewTypeWizardPage_error_InvalidPackageName, val.getMessage()));
+// return status;
+// } else if (val.getSeverity() == IStatus.WARNING) {
+// status.setWarning(Messages.format(NewWizardMessages.NewTypeWizardPage_warning_DiscouragedPackageName, val.getMessage()));
+// // continue
+// }
+// }
+//
+// ISourceFolderRoot root= getSourceFolderRoot();
+// if (root != null) {
+// fCurrSourceFolder= root.getSourceFolder(packName);
+// } else {
+// status.setError(""); //$NON-NLS-1$
+// }
+// return status;
+// }
+
+ /**
* Sets the current source folder (model and text field) to the given source folder
* root.
* @param root The new root.
* @param canBeModified if <code>false</code> the source folder field can
* not be changed by the user. If <code>true</code> the field is editable
*/
- public void setSourceFolderRoot(ISourceFolderRoot root, boolean canBeModified) {
- fCurrRoot= root;
+ public void setSourceFolder(ISourceFolder root, boolean canBeModified) {
+ fCurrSourceFolder= root;
String str= (root == null) ? "" : root.getPath().makeRelative().toString(); //$NON-NLS-1$
fContainerDialogField.setText(str);
fContainerDialogField.setEnabled(canBeModified);
@@ -304,11 +341,11 @@
* fragment root used as the source folder
*/
protected void initContainerPage(IRubyElement elem) {
- ISourceFolderRoot initRoot= null;
+ ISourceFolder initRoot= null;
if (elem != null) {
- initRoot= RubyModelUtil.getSourceFolderRoot(elem);
+ initRoot= RubyModelUtil.getSourceFolder(elem);
try {
- if (initRoot == null || initRoot.isExternal()) {
+ if (initRoot == null || ((ISourceFolderRoot)initRoot.getParent()).isExternal()) {
IRubyProject rproject= elem.getRubyProject();
if (rproject != null) {
initRoot= null;
@@ -316,13 +353,13 @@
ISourceFolderRoot[] roots= rproject.getSourceFolderRoots();
for (int i= 0; i < roots.length; i++) {
if (!roots[i].isExternal()) {
- initRoot= roots[i];
+ initRoot= roots[i].getSourceFolder("");
break;
}
}
}
if (initRoot == null) {
- initRoot= rproject.getSourceFolderRoot(rproject.getResource());
+ initRoot= rproject.getSourceFolderRoot(rproject.getResource()).getSourceFolder("");
}
}
}
@@ -330,7 +367,7 @@
RubyCore.log(e);
}
}
- setSourceFolderRoot(initRoot, true);
+ setSourceFolder(initRoot, true);
}
private void containerDialogFieldChanged(DialogField field) {
@@ -382,9 +419,9 @@
*
* @since 0.9.0
*/
- protected ISourceFolderRoot chooseContainer() {
- IRubyElement initElement= getSourceFolderRoot();
- Class[] acceptedClasses= new Class[] { IRubyProject.class, ISourceFolderRoot.class };
+ protected ISourceFolder chooseContainer() {
+ IRubyElement initElement= getSourceFolder();
+ Class[] acceptedClasses= new Class[] { IRubyProject.class, ISourceFolderRoot.class, ISourceFolder.class };
TypedElementSelectionValidator validator= new TypedElementSelectionValidator(acceptedClasses, false) {
public boolean isSelectedValid(Object element) {
try {
@@ -403,7 +440,7 @@
}
};
- acceptedClasses= new Class[] { IRubyModel.class, ISourceFolderRoot.class, IRubyProject.class };
+ acceptedClasses= new Class[] { IRubyModel.class, ISourceFolderRoot.class, IRubyProject.class, ISourceFolder.class };
ViewerFilter filter= new TypedViewerFilter(acceptedClasses) {
public boolean select(Viewer viewer, Object parent, Object element) {
if (element instanceof ISourceFolderRoot) {
@@ -413,7 +450,7 @@
}
};
- StandardRubyElementContentProvider provider= new StandardRubyElementContentProvider();
+ StandardRubyElementContentProvider provider= new StandardRubyElementContentProvider(); // FIXME Labels shouldn't give fulle path for source folders, just last name segment
ILabelProvider labelProvider= new RubyElementLabelProvider(RubyElementLabelProvider.SHOW_DEFAULT);
ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getShell(), labelProvider, provider);
dialog.setValidator(validator);
@@ -429,9 +466,11 @@
Object element= dialog.getFirstResult();
if (element instanceof IRubyProject) {
IRubyProject jproject= (IRubyProject)element;
- return jproject.getSourceFolderRoot(jproject.getProject());
+ return jproject.getSourceFolderRoot(jproject.getProject()).getSourceFolder("");
} else if (element instanceof ISourceFolderRoot) {
- return (ISourceFolderRoot)element;
+ return ((ISourceFolderRoot)element).getSourceFolder("");
+ } else if (element instanceof ISourceFolder) {
+ return (ISourceFolder)element;
}
return null;
}
@@ -446,8 +485,8 @@
* folder value is not a valid package fragment root
*
*/
- public ISourceFolderRoot getSourceFolderRoot() {
- return fCurrRoot;
+ public ISourceFolder getSourceFolder() {
+ return fCurrSourceFolder;
}
}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewTypeWizardPage.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewTypeWizardPage.java 2007-07-24 15:29:07 UTC (rev 2831)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewTypeWizardPage.java 2007-07-24 17:30:58 UTC (rev 2832)
@@ -20,27 +20,21 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.ElementListSelectionDialog;
import org.rubypeople.rdt.core.IBuffer;
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.IRubyProject;
import org.rubypeople.rdt.core.IRubyScript;
import org.rubypeople.rdt.core.ISourceFolder;
-import org.rubypeople.rdt.core.ISourceFolderRoot;
import org.rubypeople.rdt.core.ISourceRange;
import org.rubypeople.rdt.core.IType;
import org.rubypeople.rdt.core.RubyConventions;
-import org.rubypeople.rdt.core.RubyModelException;
import org.rubypeople.rdt.core.formatter.CodeFormatter;
import org.rubypeople.rdt.core.search.IRubySearchConstants;
import org.rubypeople.rdt.core.search.IRubySearchScope;
import org.rubypeople.rdt.core.search.SearchEngine;
-import org.rubypeople.rdt.internal.core.RubyProject;
import org.rubypeople.rdt.internal.corext.codemanipulation.StubUtility;
import org.rubypeople.rdt.internal.corext.util.CodeFormatterUtil;
-import org.rubypeople.rdt.internal.corext.util.Messages;
import org.rubypeople.rdt.internal.corext.util.RubyModelUtil;
-import org.rubypeople.rdt.internal.ui.RubyPlugin;
import org.rubypeople.rdt.internal.ui.RubyPluginImages;
import org.rubypeople.rdt.internal.ui.dialogs.StatusInfo;
import org.rubypeople.rdt.internal.ui.dialogs.TypeSelectionDialog2;
@@ -54,9 +48,7 @@
import org.rubypeople.rdt.internal.ui.wizards.dialogfields.ListDialogField;
import org.rubypeople.rdt.internal.ui.wizards.dialogfields.Separator;
import org.rubypeople.rdt.internal.ui.wizards.dialogfields.StringButtonDialogField;
-import org.rubypeople.rdt.internal.ui.wizards.dialogfields.StringButtonStatusDialogField;
import org.rubypeople.rdt.internal.ui.wizards.dialogfields.StringDialogField;
-import org.rubypeople.rdt.ui.RubyElementLabelProvider;
public abstract class NewTypeWizardPage extends NewContainerWizardPage {
@@ -115,7 +107,6 @@
*/
private IType fCurrType;
private StringDialogField fTypeNameDialogField;
- private StringButtonStatusDialogField fPackageDialogField;
private StringButtonDialogField fSuperClassDialogField;
private ListDialogField fSuperModulesDialogField;
@@ -127,7 +118,6 @@
protected IStatus fSuperModulesStatus;
private int fTypeKind;
- private ISourceFolder fCurrSourceFolder;
private boolean fCanModifySourceFolder;
@@ -170,12 +160,6 @@
TypeFieldsAdapter adapter= new TypeFieldsAdapter();
- fPackageDialogField= new StringButtonStatusDialogField(adapter);
- fPackageDialogField.setDialogFieldListener(adapter);
- fPackageDialogField.setLabelText(getPackageLabel());
- fPackageDialogField.setButtonLabel(NewWizardMessages.NewTypeWizardPage_package_button);
- fPackageDialogField.setStatusWidthHint(NewWizardMessages.NewTypeWizardPage_default);
-
fTypeNameDialogField= new StringDialogField();
fTypeNameDialogField.setDialogFieldListener(adapter);
fTypeNameDialogField.setLabelText(getTypeNameLabel());
@@ -207,71 +191,11 @@
* @return the label that is used for the package input field.
* @since 3.2
*/
- protected String getPackageLabel() {
+ protected String getSourceFolderLabel() {
return NewWizardMessages.NewTypeWizardPage_package_label;
}
/**
- * A hook method that gets called when the package field has changed. The method
- * validates the package name and returns the status of the validation. The validation
- * also updates the package fragment model.
- * <p>
- * Subclasses may extend this method to perform their own validation.
- * </p>
- *
- * @return the status of the validation
- */
- protected IStatus packageChanged() {
- StatusInfo status= new StatusInfo();
- fPackageDialogField.enableButton(getSourceFolderRoot() != null);
-
- String packName= getPackageText();
- if (packName.length() > 0) {
- IStatus val= RubyConventions.validateSourceFolderName(packName);
- if (val.getSeverity() == IStatus.ERROR) {
- status.setError(Messages.format(NewWizardMessages.NewTypeWizardPage_error_InvalidPackageName, val.getMessage()));
- return status;
- } else if (val.getSeverity() == IStatus.WARNING) {
- status.setWarning(Messages.format(NewWizardMessages.NewTypeWizardPage_warning_DiscouragedPackageName, val.getMessage()));
- // continue
- }
- }
-
- ISourceFolderRoot root= getSourceFolderRoot();
- if (root != null) {
- fCurrSourceFolder= root.getSourceFolder(packName);
- } else {
- status.setError(""); //$NON-NLS-1$
- }
- return status;
- }
-
- /**
- * Returns the text of the package input field.
- *
- * @return the text of the package input field
- */
- public String getPackageText() {
- return fPackageDialogField.getText();
- }
-
- /**
- * Creates the controls for the package name field. Expects a <code>GridLayout</code> with at
- * least 4 columns.
- *
- * @param composite the parent composite
- * @param nColumns number of columns to span
- */
- protected void createPackageControls(Composite composite, int nColumns) {
- fPackageDialogField.doFillIntoGrid(composite, nColumns);
- Text text= fPackageDialogField.getTextControl(null);
- LayoutUtil.setWidthHint(text, getMaxFieldWidth());
- LayoutUtil.setHorizontalGrabbing(text);
-// ControlContentAssistHelper.createTextContentAssistant(text, fCurrPackageCompletionProcessor);
-// TextFieldNavigationHandler.install(text);
- }
-
- /**
* Creates the controls for the type name field. Expects a <code>GridLayout</code> with at
* least 2 columns.
*
@@ -408,7 +332,7 @@
}
private void typePageLinkActivated(SelectionEvent e) {
- ISourceFolderRoot root= getSourceFolderRoot();
+ ISourceFolder root= getSourceFolder();
if (root != null) {
// TODO Uncomment!
// PreferenceDialog dialog= PreferencesUtil.createPropertyDialogOn(getShell(), root.getProject(), CodeTemplatePreferencePage.PROP_ID, null, null);
@@ -421,12 +345,7 @@
}
private void typePageChangeControlPressed(DialogField field) {
- if (field == fPackageDialogField) {
- ISourceFolder pack= chooseSourceFolder();
- if (pack != null) {
- fPackageDialogField.setText(pack.getElementName());
- }
- } else if (field == fSuperClassDialogField) {
+ if (field == fSuperClassDialogField) {
IType type= chooseSuperClass();
if (type != null) {
// TODO Spit out fully qualified name?!
@@ -435,50 +354,6 @@
}
}
- /**
- * Opens a selection dialog that allows to select a package.
- *
- * @return returns the selected package or <code>null</code> if the dialog has been canceled.
- * The caller typically sets the result to the package input field.
- * <p>
- * Clients can override this method if they want to offer a different dialog.
- * </p>
- *
- * @since 0.9.0
- */
- protected ISourceFolder chooseSourceFolder() {
- ISourceFolderRoot froot= getSourceFolderRoot();
- IRubyElement[] packages= null;
- try {
- if (froot != null && froot.exists()) {
- packages= froot.getChildren();
- }
- } catch (RubyModelException e) {
- RubyPlugin.log(e);
- }
- if (packages == null) {
- packages= new IRubyElement[0];
- }
-
- ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), new RubyElementLabelProvider(RubyElementLabelProvider.SHOW_DEFAULT));
- dialog.setIgnoreCase(false);
- dialog.setTitle(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_title);
- dialog.setMessage(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_description);
- dialog.setEmptyListMessage(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_empty);
- dialog.setElements(packages);
- dialog.setHelpAvailable(false);
-
- ISourceFolder pack= getSourceFolder();
- if (pack != null) {
- dialog.setInitialSelections(new Object[] { pack });
- }
-
- if (dialog.open() == Window.OK) {
- return (ISourceFolder) dialog.getFirstResult();
- }
- return null;
- }
-
private void typePageCustomButtonPressed(DialogField field, int index) {
if (field == fSuperModulesDialogField) {
chooseSuperModules();
@@ -553,39 +428,12 @@
}
return newName.toString();
}
-
- /**
- * Returns the package fragment corresponding to the current input.
- *
- * @return a package fragment or <code>null</code> if the input
- * could not be resolved.
- */
- public ISourceFolder getSourceFolder() {
- return fCurrSourceFolder;
- }
- /**
- * Sets the source folder to the given value. The method updates the model
- * and the text of the control.
- *
- * @param pack the source folder to be set
- * @param canBeModified if <code>true</code> the package fragment is
- * editable; otherwise it is read-only.
- */
- public void setSourceFolder(ISourceFolder pack, boolean canBeModified) {
- fCurrSourceFolder= pack;
- fCanModifySourceFolder= canBeModified;
- String str= (pack == null) ? "" : pack.getElementName(); //$NON-NLS-1$
- fPackageDialogField.setText(str);
- updateEnableState();
- }
-
/*
* Updates the enable state of buttons related to the enclosing type selection checkbox.
*/
private void updateEnableState() {
- boolean enclosing= isEnclosingTypeSelected();
- fPackageDialogField.setEnabled(fCanModifySourceFolder && !enclosing);
+
}
private boolean isEnclosingTypeSelected() {
@@ -607,18 +455,14 @@
monitor.beginTask(NewWizardMessages.NewTypeWizardPage_operationdesc, 8);
- ISourceFolderRoot root = getSourceFolderRoot();
ISourceFolder pack= getSourceFolder();
- if (pack == null) {
- pack= root.getSourceFolder(new String[] {});
- }
- if (!pack.exists()) {
- String packName= pack.getElementName();
- pack= root.createSourceFolder(packName, true, new SubProgressMonitor(monitor, 1));
- } else {
+// if (!pack.exists()) {
+// String packName= pack.getElementName();
+// pack= root.createSourceFolder(packName, true, new SubProgressMonitor(monitor, 1));
+// } else {
monitor.worked(1);
- }
+// }
boolean needsSave;
IRubyScript connectedCU= null;
@@ -727,7 +571,7 @@
* @since 1.0
*/
protected void chooseSuperModules() {
- ISourceFolderRoot root= getSourceFolderRoot();
+ ISourceFolder root= getSourceFolder();
if (root == null) {
return;
}
@@ -811,14 +655,8 @@
*/
private void typePageDialogFieldChanged(DialogField field) {
String fieldName= null;
- if (field == fPackageDialogField) {
- /*fPackageStatus=*/ packageChanged();
-// updatePackageStatusLabel();
+ if (field == fTypeNameDialogField) {
fTypeNameStatus= typeNameChanged();
- fSuperClassStatus= superClassChanged();
- fieldName= PACKAGE;
- } else if (field == fTypeNameDialogField) {
- fTypeNameStatus= typeNameChanged();
fieldName= TYPENAME;
} else if (field == fSuperClassDialogField) {
fSuperClassStatus= superClassChanged();
@@ -853,7 +691,7 @@
*/
protected IStatus superClassChanged() {
StatusInfo status= new StatusInfo();
- ISourceFolderRoot root= getSourceFolderRoot();
+ ISourceFolder root= getSourceFolder();
fSuperClassDialogField.enableButton(root != null);
String sclassName= getSuperClass();
@@ -916,7 +754,7 @@
protected void handleFieldChanged(String fieldName) {
super.handleFieldChanged(fieldName);
if (fieldName == CONTAINER) {
- /*fPackageStatus=*/ packageChanged();
+// /*fPackageStatus=*/ packageChanged();
// fEnclosingTypeStatus= enclosingTypeChanged();
fTypeNameStatus= typeNameChanged();
fSuperClassStatus= superClassChanged();
@@ -936,17 +774,12 @@
ArrayList initSuperinterfaces= new ArrayList(5);
IRubyProject project= null;
- ISourceFolder folder= null;
+ ISourceFolder folder= getSourceFolder();
IType enclosingType= null;
if (elem != null) {
// evaluate the enclosing type
project= elem.getRubyProject();
- if (elem instanceof RubyProject) {
- folder = getSourceFolderRoot().getSourceFolder(new String[0]);
- } else {
- folder= (ISourceFolder) elem.getAncestor(IRubyElement.SOURCE_FOLDER);
- }
IType typeInCU= (IType) elem.getAncestor(IRubyElement.TYPE);
if (typeInCU != null) {
if (typeInCU.getRubyScript() != null) {
@@ -1019,7 +852,7 @@
protected IStatus superInterfacesChanged() {
StatusInfo status= new StatusInfo();
- ISourceFolderRoot root= getSourceFolderRoot();
+ ISourceFolder root= getSourceFolder();
fSuperModulesDialogField.enableButton(0, root != null);
if (root != null) {
@@ -1052,7 +885,7 @@
* @since 0.9
*/
protected IType chooseSuperClass() {
- ISourceFolderRoot root= getSourceFolderRoot();
+ ISourceFolder root= getSourceFolder();
if (root == null) {
return null;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-24 15:29:18
|
Revision: 2831
http://svn.sourceforge.net/rubyeclipse/?rev=2831&view=rev
Author: cawilliams
Date: 2007-07-24 08:29:07 -0700 (Tue, 24 Jul 2007)
Log Message:
-----------
fix missing SourceMenu label
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/plugin.properties
Modified: trunk/org.rubypeople.rdt.ui/plugin.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.properties 2007-07-24 15:28:26 UTC (rev 2830)
+++ trunk/org.rubypeople.rdt.ui/plugin.properties 2007-07-24 15:29:07 UTC (rev 2831)
@@ -85,7 +85,7 @@
EditorRubyFile.filenames=Rakefile, generate, profiler, console, server, reaper, spawner, spinner, about, destroy
ExternalEditorRubyFile.name=Ext. Ruby Editor
-Ruby.menu.label=Ru&by
+SourceMenu.label= &Source
RubyActionSet.label=Ruby Actions
UncommentAction.label=&Uncomment@Ctrl+\\
CommentAction.label=&Comment@Ctrl+/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-24 15:28:27
|
Revision: 2830
http://svn.sourceforge.net/rubyeclipse/?rev=2830&view=rev
Author: cawilliams
Date: 2007-07-24 08:28:26 -0700 (Tue, 24 Jul 2007)
Log Message:
-----------
hook indent empty lines pref up. Add new pref for indenting "when" in case statements.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/formatter/DefaultCodeFormatterConstants.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/DefaultCodeFormatterOptions.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/OldCodeFormatter.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/formatter/DefaultCodeFormatterConstants.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/formatter/DefaultCodeFormatterConstants.java 2007-07-24 15:28:19 UTC (rev 2829)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/formatter/DefaultCodeFormatterConstants.java 2007-07-24 15:28:26 UTC (rev 2830)
@@ -111,6 +111,21 @@
*/
public static final String FORMATTER_INDENT_EMPTY_LINES = RubyCore.PLUGIN_ID
+ ".formatter.indent_empty_lines"; //$NON-NLS-1$
+
+ /**
+ * <pre>
+ * FORMATTER / Option to ident empty lines
+ * - option id: "org.rubypeople.rdt.core.formatter.indent_case_body"
+ * - possible values: { TRUE, FALSE }
+ * - default: FALSE
+ * </pre>
+ *
+ * @see #TRUE
+ * @see #FALSE
+ * @since 1.0
+ */
+ public static final String FORMATTER_INDENT_CASE_BODY = RubyCore.PLUGIN_ID
+ + ".formatter.indent_case_body"; //$NON-NLS-1$
/**
* <pre>
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/DefaultCodeFormatterOptions.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/DefaultCodeFormatterOptions.java 2007-07-24 15:28:19 UTC (rev 2829)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/DefaultCodeFormatterOptions.java 2007-07-24 15:28:26 UTC (rev 2830)
@@ -19,6 +19,9 @@
public int tab_char;
public int tab_size;
public int comment_line_length;
+
+ public boolean indent_case_body = true;
+ public boolean indent_empty_lines = true;
public static DefaultCodeFormatterOptions getDefaultSettings() {
DefaultCodeFormatterOptions options = new DefaultCodeFormatterOptions();
@@ -52,6 +55,8 @@
this.tab_char = TAB;
this.tab_size = DEFAULT_TAB_SIZE;
this.indentation_size = DEFAULT_INDENT_SIZE;
+ this.indent_case_body = true;
+ this.indent_empty_lines = true;
}
public void setEclipseDefaultSettings() {
@@ -63,6 +68,8 @@
this.tab_char = SPACE;
this.tab_size = 2;
this.indentation_size = 2;
+ this.indent_case_body = true;
+ this.indent_empty_lines = true;
}
public Map getMap() {
@@ -84,10 +91,34 @@
}
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, Integer
.toString(this.tab_size));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_CASE_BODY, Boolean
+ .toString(this.indent_case_body));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_EMPTY_LINES, Boolean
+ .toString(this.indent_empty_lines));
return options;
}
public void set(Map settings) {
+ final Object indentCaseBodyOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_CASE_BODY);
+ if (indentCaseBodyOption != null) {
+ try {
+ this.indent_case_body = Boolean.parseBoolean((String) indentCaseBodyOption);
+ } catch (NumberFormatException e) {
+ this.indent_case_body = true;
+ } catch(ClassCastException e) {
+ this.indent_case_body = true;
+ }
+ }
+ final Object indentEmptyLinesOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_EMPTY_LINES);
+ if (indentEmptyLinesOption != null) {
+ try {
+ this.indent_empty_lines = Boolean.parseBoolean((String) indentEmptyLinesOption);
+ } catch (NumberFormatException e) {
+ this.indent_empty_lines = true;
+ } catch(ClassCastException e) {
+ this.indent_empty_lines = true;
+ }
+ }
final Object commentLineLengthOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH);
if (commentLineLengthOption != null) {
try {
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/OldCodeFormatter.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/OldCodeFormatter.java 2007-07-24 15:28:19 UTC (rev 2829)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/OldCodeFormatter.java 2007-07-24 15:28:26 UTC (rev 2830)
@@ -16,7 +16,7 @@
public class OldCodeFormatter extends CodeFormatter {
private final static String BLOCK_BEGIN_RE = "(class|module|def|if|unless|case|while|until|for|begin|do)";
- private final static String BLOCK_MID_RE = "(else|elsif|rescue|ensure)";
+ private String BLOCK_MID_RE = "(else|elsif|rescue|ensure)";
private final static String BLOCK_END_RE = "(end)";
private final static String DELIMITER_RE = "[?$/(){}#\\`.:\\]\\[]";
private final static String[] LITERAL_BEGIN_LITERALS = { "\"", "'", "=begin", "%[Qqrxw]?.",
@@ -174,7 +174,7 @@
try {
pat = Pattern.compile("(^|[\\s]|;)" + BLOCK_BEGIN_RE + "($|[\\s]|" + DELIMITER_RE
- + ")|(^|[\\s])" + BLOCK_MID_RE + "($|[\\s]|" + DELIMITER_RE + ")|(^|[\\s]|;)"
+ + ")|(^|[\\s])" + getBlockMiddleRegex() + "($|[\\s]|" + DELIMITER_RE + ")|(^|[\\s]|;)"
+ BLOCK_END_RE + "($|[\\s]|;)|" + LITERAL_BEGIN_RE + "|" + DELIMITER_RE);
} catch (PatternSyntaxException e) {
System.out.println(e);
@@ -327,6 +327,15 @@
return firstBlockMarker;
}
+ private String getBlockMiddleRegex() {
+ if (this.preferences.indent_case_body) {
+ return BLOCK_MID_RE;
+ }
+ StringBuffer buffer = new StringBuffer(BLOCK_MID_RE);
+ buffer.insert(1, "when|");
+ return buffer.toString();
+ }
+
/*
* (defun ruby-forward-string (term &optional end no-error expand) (let ((n
* 1) (c (string-to-char term)) (re (if expand (concat
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-24 15:28:23
|
Revision: 2829
http://svn.sourceforge.net/rubyeclipse/?rev=2829&view=rev
Author: cawilliams
Date: 2007-07-24 08:28:19 -0700 (Tue, 24 Jul 2007)
Log Message:
-----------
hook indent empty lines pref up. Add new pref for indenting "when" in case statements.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/formatter/IndentationTabPage.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/formatter/IndentationTabPage.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/formatter/IndentationTabPage.java 2007-07-24 14:54:05 UTC (rev 2828)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/formatter/IndentationTabPage.java 2007-07-24 15:28:19 UTC (rev 2829)
@@ -87,7 +87,8 @@
});
final Group classGroup = createGroup(numColumns, composite, FormatterMessages.IndentationTabPage_indent_group_title);
- createCheckboxPref(classGroup, numColumns, FormatterMessages.IndentationTabPage_indent_empty_lines, DefaultCodeFormatterConstants.FORMATTER_INDENT_EMPTY_LINES, FALSE_TRUE);
+ createCheckboxPref(classGroup, numColumns, FormatterMessages.IndentationTabPage_switch_group_option_indent_statements_within_case_body, DefaultCodeFormatterConstants.FORMATTER_INDENT_CASE_BODY, FALSE_TRUE);
+ createCheckboxPref(classGroup, numColumns, FormatterMessages.IndentationTabPage_indent_empty_lines, DefaultCodeFormatterConstants.FORMATTER_INDENT_EMPTY_LINES, FALSE_TRUE);
}
public void initializePage() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-24 14:54:20
|
Revision: 2828
http://svn.sourceforge.net/rubyeclipse/?rev=2828&view=rev
Author: cawilliams
Date: 2007-07-24 07:54:05 -0700 (Tue, 24 Jul 2007)
Log Message:
-----------
fix #5259 - add test and make formatter match indentation that editor uses for case/when statements. Indent the whens!
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/FormatTestData.xml
trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/TC_CodeFormatter.java
Modified: trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/FormatTestData.xml
===================================================================
--- trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/FormatTestData.xml 2007-07-24 14:53:57 UTC (rev 2827)
+++ trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/FormatTestData.xml 2007-07-24 14:54:05 UTC (rev 2828)
@@ -694,5 +694,33 @@
</part>
</test>
+<test ID="CaseWithWhens">
+<part>
+<assertionMessage>Indent when</assertionMessage>
+<unformatted>
+module Foo
+ def bar
+ case baz
+ when 'sweet harmonious biscuits'
+when 'yuck'
+ when 'eww'
+ end
+ end
+end
+</unformatted>
+<formatted>
+module Foo
+ def bar
+ case baz
+ when 'sweet harmonious biscuits'
+ when 'yuck'
+ when 'eww'
+ end
+ end
+end
+</formatted>
+</part>
+</test>
+
</tests>
Modified: trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/TC_CodeFormatter.java
===================================================================
--- trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/TC_CodeFormatter.java 2007-07-24 14:53:57 UTC (rev 2827)
+++ trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/TC_CodeFormatter.java 2007-07-24 14:54:05 UTC (rev 2828)
@@ -140,4 +140,8 @@
doTest("LineStartingWithParen");
}
+ public void testCaseWithWhens() {
+ doTest("CaseWithWhens");
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-24 14:54:20
|
Revision: 2827
http://svn.sourceforge.net/rubyeclipse/?rev=2827&view=rev
Author: cawilliams
Date: 2007-07-24 07:53:57 -0700 (Tue, 24 Jul 2007)
Log Message:
-----------
fix #5259 - add test and make formatter match indentation that editor uses for case/when statements. Indent the whens!
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/OldCodeFormatter.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/OldCodeFormatter.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/OldCodeFormatter.java 2007-07-24 14:50:32 UTC (rev 2826)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/OldCodeFormatter.java 2007-07-24 14:53:57 UTC (rev 2827)
@@ -16,7 +16,7 @@
public class OldCodeFormatter extends CodeFormatter {
private final static String BLOCK_BEGIN_RE = "(class|module|def|if|unless|case|while|until|for|begin|do)";
- private final static String BLOCK_MID_RE = "(else|elsif|when|rescue|ensure)";
+ private final static String BLOCK_MID_RE = "(else|elsif|rescue|ensure)";
private final static String BLOCK_END_RE = "(end)";
private final static String DELIMITER_RE = "[?$/(){}#\\`.:\\]\\[]";
private final static String[] LITERAL_BEGIN_LITERALS = { "\"", "'", "=begin", "%[Qqrxw]?.",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-24 14:50:34
|
Revision: 2826
http://svn.sourceforge.net/rubyeclipse/?rev=2826&view=rev
Author: cawilliams
Date: 2007-07-24 07:50:32 -0700 (Tue, 24 Jul 2007)
Log Message:
-----------
part of fix for #5259 - RDT case statement breaks indentation. Normal editing behaves more like user expects now.
Still have to make sure code formatter actually uses same indentation rules...
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyAutoIndentStrategy.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyAutoIndentStrategy.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyAutoIndentStrategy.java 2007-07-24 14:16:50 UTC (rev 2825)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyAutoIndentStrategy.java 2007-07-24 14:50:32 UTC (rev 2826)
@@ -141,8 +141,8 @@
private boolean shouldDeIndent(String trimmed) {
if (trimmed == null || trimmed.length() == 0) return false;
- return trimmed.equals("rescue") || trimmed.equals("else") || trimmed.equals("ensure") || trimmed.equals(BLOCK_CLOSER)
- || trimmed.startsWith("when ") || trimmed.startsWith("elsif ");
+ return trimmed.equals("rescue") || trimmed.equals("else") || trimmed.equals("ensure")
+ || trimmed.equals(BLOCK_CLOSER) || trimmed.startsWith("elsif ");
}
private boolean unclosedBlock(IDocument d, String trimmed, int offset) {
@@ -177,7 +177,7 @@
private boolean atStartOfBlock(String line) {
return line.startsWith("class ") || line.startsWith("if ") || line.startsWith("module ")
- || line.startsWith("unless ") || line.startsWith("def ") || line.equals("begin")
+ || line.startsWith("unless ") || line.startsWith("def ") || line.equals("begin") || line.startsWith("case ")
|| openBlockPattern.matcher(line).matches();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-24 14:16:54
|
Revision: 2825
http://svn.sourceforge.net/rubyeclipse/?rev=2825&view=rev
Author: cawilliams
Date: 2007-07-24 07:16:50 -0700 (Tue, 24 Jul 2007)
Log Message:
-----------
fix some of the wording on the jobs this class creates
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java 2007-07-23 20:47:33 UTC (rev 2824)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java 2007-07-24 14:16:50 UTC (rev 2825)
@@ -305,7 +305,7 @@
String command = UPDATE_COMMAND + " " + gem.getName();
ILaunchConfiguration config = createGemLaunchConfiguration(command, true);
final ILaunch launch = config.launch(ILaunchManager.RUN_MODE, null);
- Job job = new Job("Notify gem listeners of uninstalled gem") {
+ Job job = new Job("Updating gem " + gem.getName()) {
@Override
protected IStatus run(IProgressMonitor monitor) {
@@ -405,7 +405,7 @@
}
ILaunchConfiguration config = createGemLaunchConfiguration(command, true);
final ILaunch launch = config.launch(ILaunchManager.RUN_MODE, null);
- Job job = new Job("Notify gem listeners of uninstalled gem") {
+ Job job = new Job("Installing gem " + gem.getName()) {
@Override
protected IStatus run(IProgressMonitor monitor) {
@@ -454,7 +454,7 @@
}
ILaunchConfiguration config = createGemLaunchConfiguration(command, true);
final ILaunch launch = config.launch(ILaunchManager.RUN_MODE, null);
- Job job = new Job("Notify gem listeners of uninstalled gem") {
+ Job job = new Job("Notifying gem listeners of uninstalled gem") {
@Override
protected IStatus run(IProgressMonitor monitor) {
@@ -633,7 +633,7 @@
try {
ILaunchConfiguration config = createGemLaunchConfiguration(UPDATE_COMMAND, true);
final ILaunch launch = config.launch(ILaunchManager.RUN_MODE, null);
- Job job = new Job("Notify gem listeners of uninstalled gem") {
+ Job job = new Job("Updating gem listing") {
@Override
protected IStatus run(IProgressMonitor monitor) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-23 20:47:34
|
Revision: 2824
http://svn.sourceforge.net/rubyeclipse/?rev=2824&view=rev
Author: cawilliams
Date: 2007-07-23 13:47:33 -0700 (Mon, 23 Jul 2007)
Log Message:
-----------
fix up context menu for ruby editor - add back source entries (format/toggle comment, etc)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/RefactoringActionGroup.java
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/RefactoringActionGroup.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/RefactoringActionGroup.java 2007-07-23 20:47:23 UTC (rev 2823)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/RefactoringActionGroup.java 2007-07-23 20:47:33 UTC (rev 2824)
@@ -11,7 +11,6 @@
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
import org.eclipse.ui.actions.ActionGroup;
import org.rubypeople.rdt.refactoring.core.TextSelectionProvider;
import org.rubypeople.rdt.refactoring.core.convertlocaltofield.ConvertLocalToFieldRefactoring;
@@ -36,14 +35,11 @@
public class RefactoringActionGroup extends ActionGroup {
- private static final String INSERT_AFTER_GROUP_NAME = "group.edit"; //$NON-NLS-1$
-
public void fillContextMenu(IMenuManager menu) {
TextSelectionProvider selectionProvider = new TextSelectionProvider(null);
- menu.insertAfter(INSERT_AFTER_GROUP_NAME, new Separator());
- menu.insertAfter(INSERT_AFTER_GROUP_NAME, getSourceMenu(menu, selectionProvider));
- menu.insertAfter(INSERT_AFTER_GROUP_NAME, getRefactorMenu(selectionProvider));
- menu.insertAfter(INSERT_AFTER_GROUP_NAME, new Separator());
+ IMenuManager source = menu.findMenuUsingPath(RubyActionGroup.MENU_ID);
+ addSourceMenuItems(source, selectionProvider);
+ menu.insertAfter(RubyActionGroup.MENU_ID, getRefactorMenu(selectionProvider));
}
private IMenuManager getRefactorMenu(TextSelectionProvider selectionProvider) {
@@ -66,11 +62,9 @@
return submenu;
}
- private IMenuManager getSourceMenu(IMenuManager menu, TextSelectionProvider selectionProvider) {
- IMenuManager submenu = RubyActionGroup.getRubySourceMenu(menu) ;
- submenu.insertAfter(RubyActionGroup.RUBY_SOURCE_SEPARATOR, new RefactoringAction(GenerateAccessorsRefactoring.class, GenerateAccessorsRefactoring.NAME, selectionProvider));
- submenu.insertAfter(RubyActionGroup.RUBY_SOURCE_SEPARATOR, new RefactoringAction(GenerateConstructorRefactoring.class, GenerateConstructorRefactoring.NAME, selectionProvider));
- submenu.insertAfter(RubyActionGroup.RUBY_SOURCE_SEPARATOR, new RefactoringAction(OverrideMethodRefactoring.class, OverrideMethodRefactoring.NAME, selectionProvider));
- return submenu;
+ private void addSourceMenuItems(IMenuManager source, TextSelectionProvider selectionProvider) {
+ source.add(new RefactoringAction(GenerateAccessorsRefactoring.class, GenerateAccessorsRefactoring.NAME, selectionProvider));
+ source.add(new RefactoringAction(GenerateConstructorRefactoring.class, GenerateConstructorRefactoring.NAME, selectionProvider));
+ source.add(new RefactoringAction(OverrideMethodRefactoring.class, OverrideMethodRefactoring.NAME, selectionProvider));
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-23 20:47:28
|
Revision: 2823
http://svn.sourceforge.net/rubyeclipse/?rev=2823&view=rev
Author: cawilliams
Date: 2007-07-23 13:47:23 -0700 (Mon, 23 Jul 2007)
Log Message:
-----------
fix up context menu for ruby editor - add back source entries (format/toggle comment, etc)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/plugin.xml
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/RubyActionGroup.java
Modified: trunk/org.rubypeople.rdt.ui/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.xml 2007-07-23 19:30:39 UTC (rev 2822)
+++ trunk/org.rubypeople.rdt.ui/plugin.xml 2007-07-23 20:47:23 UTC (rev 2823)
@@ -708,21 +708,106 @@
</command>
</extension>
+
<extension
point="org.eclipse.ui.actionSets">
<actionSet
- label="%RubyActionSet.label"
+ label="%CodingActionSet.label"
+ description="%CodingActionSet.description"
visible="false"
- id="org.rubypeople.rdt.ui.rubyActionSet">
+ id="org.rubypeople.rdt.ui.CodingActionSet">
+<!-- =========================================================================== -->
+<!-- Source Menu -->
+<!-- =========================================================================== -->
<menu
- label="%Ruby.menu.label"
+ label="%SourceMenu.label"
path="edit"
- id="org.rubypeople.rdt.ui.ruby.menu">
+ id="org.rubypeople.rdt.ui.source.menu">
+ <separator
+ name="commentGroup">
+ </separator>
<separator
name="editGroup">
</separator>
+ <separator
+ name="generateGroup">
+ </separator>
+ <separator
+ name="codeGroup">
+ </separator>
+ <separator
+ name="convertGroup">
+ </separator>
</menu>
+
+<!-- edit group -->
+ <action
+ definitionId="org.rubypeople.rdt.ui.edit.text.ruby.uncomment"
+ label="%UncommentAction.label"
+ menubarPath="org.rubypeople.rdt.ui.source.menu/editGroup"
+ retarget="true"
+ id="org.rubypeople.rdt.ui.actions.Uncomment">
+ </action>
<action
+ definitionId="org.rubypeople.rdt.ui.edit.text.ruby.comment"
+ label="%CommentAction.label"
+ menubarPath="org.rubypeople.rdt.ui.source.menu/editGroup"
+ retarget="true"
+ id="org.rubypeople.rdt.ui.actions.Comment">
+ </action>
+ <action
+ definitionId="org.rubypeople.rdt.ui.edit.text.ruby.toggle.comment"
+ label="%ToggleCommentAction.label"
+ retarget="true"
+ menubarPath="org.rubypeople.rdt.ui.source.menu/editGroup"
+ id="org.rubypeople.rdt.ui.actions.ToggleComment">
+ </action>
+ <action
+ definitionId="org.rubypeople.rdt.ui.edit.text.ruby.format"
+ label="%FormatAction.label"
+ retarget="true"
+ menubarPath="org.rubypeople.rdt.ui.source.menu/editGroup"
+ id="org.rubypeople.rdt.ui.actions.Format">
+ </action>
+ <action
+ definitionId="org.rubypeople.rdt.ui.edit.text.ruby.surround.with.begin.rescue"
+ label="%SurroundWithBeginRescueAction.label"
+ retarget="true"
+ menubarPath="org.rubypeople.rdt.ui.source.menu/editGroup"
+ id="org.rubypeople.rdt.ui.actions.SurroundWithBeginRescue">
+ </action>
+<!-- Comment Group -->
+ </actionSet>
+ </extension>
+ <extension
+ point="org.eclipse.ui.actionSetPartAssociations">
+ <actionSetPartAssociation
+ targetID="org.rubypeople.rdt.ui.CodingActionSet">
+ <part
+ id="org.rubypeople.rdt.ui.TypeHierarchy">
+ </part>
+ <part
+ id="org.rubypeople.rdt.ui.EditorRubyFile">
+ </part>
+ <part
+ id="org.rubypeople.rdt.ui.ProjectsView">
+ </part>
+ <part
+ id="org.rubypeople.rdt.ui.TypesView">
+ </part>
+ <part
+ id="org.rubypeople.rdt.ui.MembersView">
+ </part>
+ </actionSetPartAssociation>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.actionSets">
+ <actionSet
+ label="%RubyActionSet.label"
+ visible="false"
+ id="org.rubypeople.rdt.ui.rubyActionSet">
+ <action
class="org.rubypeople.rdt.ui.actions.OpenTypeAction"
definitionId="org.rubypeople.rdt.ui.edit.text.ruby.open.type"
id="org.rubypeople.rdt.ui.actions.OpenType"
@@ -756,41 +841,6 @@
menubarPath="project/additions"
id="addRubyNature">
</action>
- <action
- definitionId="org.rubypeople.rdt.ui.edit.text.ruby.uncomment"
- label="%UncommentAction.label"
- menubarPath="org.rubypeople.rdt.ui.ruby.menu/editGroup"
- retarget="true"
- id="org.rubypeople.rdt.ui.actions.Uncomment">
- </action>
- <action
- definitionId="org.rubypeople.rdt.ui.edit.text.ruby.comment"
- label="%CommentAction.label"
- menubarPath="org.rubypeople.rdt.ui.ruby.menu/editGroup"
- retarget="true"
- id="org.rubypeople.rdt.ui.actions.Comment">
- </action>
- <action
- definitionId="org.rubypeople.rdt.ui.edit.text.ruby.toggle.comment"
- label="%ToggleCommentAction.label"
- retarget="true"
- menubarPath="org.rubypeople.rdt.ui.ruby.menu/editGroup"
- id="org.rubypeople.rdt.ui.actions.ToggleComment">
- </action>
- <action
- definitionId="org.rubypeople.rdt.ui.edit.text.ruby.format"
- label="%FormatAction.label"
- retarget="true"
- menubarPath="org.rubypeople.rdt.ui.ruby.menu/editGroup"
- id="org.rubypeople.rdt.ui.actions.Format">
- </action>
- <action
- definitionId="org.rubypeople.rdt.ui.edit.text.ruby.surround.with.begin.rescue"
- label="%SurroundWithBeginRescueAction.label"
- retarget="true"
- menubarPath="org.rubypeople.rdt.ui.ruby.menu/editGroup"
- id="org.rubypeople.rdt.ui.actions.SurroundWithBeginRescue">
- </action>
</actionSet>
<actionSet
label="%RubyElementCreationActionSet.label"
@@ -868,6 +918,9 @@
id="org.rubypeople.rdt.ui.ViewRubyResources">
</part>
<part
+ id="org.rubypeople.rdt.ui.TypeHierarchy">
+ </part>
+ <part
id="org.rubypeople.rdt.ui.EditorRubyFile">
</part>
<part
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java 2007-07-23 19:30:39 UTC (rev 2822)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java 2007-07-23 20:47:23 UTC (rev 2823)
@@ -131,6 +131,7 @@
import org.rubypeople.rdt.ui.actions.FormatAction;
import org.rubypeople.rdt.ui.actions.IRubyEditorActionDefinitionIds;
import org.rubypeople.rdt.ui.actions.OpenEditorActionGroup;
+import org.rubypeople.rdt.ui.actions.RubyActionGroup;
import org.rubypeople.rdt.ui.actions.RubySearchActionGroup;
import org.rubypeople.rdt.ui.actions.SurroundWithBeginRescueAction;
import org.rubypeople.rdt.ui.text.folding.IRubyFoldingStructureProvider;
@@ -200,10 +201,10 @@
private BracketInserter fBracketInserter = new BracketInserter();
private CompositeActionGroup fActionGroups;
private CompositeActionGroup fContextMenuGroup;
-
+ private RubyActionGroup fGenerateActionGroup;
+
private InformationPresenter fInformationPresenter;
-
public RubyEditor() {
super();
setDocumentProvider(RubyPlugin.getDefault().getRubyDocumentProvider());
@@ -226,6 +227,32 @@
protected void createActions() {
super.createActions();
+ ActionGroup oeg, rsg;
+ fActionGroups= new CompositeActionGroup(new ActionGroup[] {
+ oeg= new OpenEditorActionGroup(this),
+ rsg= new RubySearchActionGroup(this)
+ });
+
+ fGenerateActionGroup= new RubyActionGroup(this, ITextEditorActionConstants.GROUP_EDIT);
+ fContextMenuGroup= new CompositeActionGroup(new ActionGroup[] {oeg, rsg, fGenerateActionGroup});
+
+ fFoldingGroup= new FoldingActionGroup(this, getViewer());
+
+ ISelectionProvider provider= getSite().getSelectionProvider();
+ ISelection selection= provider.getSelection();
+
+ ResourceAction resAction= new TextOperationAction(RubyEditorMessages.getBundleForConstructedKeys(), "ShowRDoc.", this, ISourceViewer.INFORMATION, true); //$NON-NLS-1$
+ resAction= new InformationDispatchAction(RubyEditorMessages.getBundleForConstructedKeys(), "ShowRDoc.", (TextOperationAction) resAction); //$NON-NLS-1$
+ resAction.setActionDefinitionId(IRubyEditorActionDefinitionIds.SHOW_RDOC);
+ setAction("ShowRDoc", resAction); //$NON-NLS-1$
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(resAction, IRubyHelpContextIds.SHOW_JAVADOC_ACTION);
+
+ SurroundWithBeginRescueAction beginRescueAction = new SurroundWithBeginRescueAction(this);
+ beginRescueAction.setActionDefinitionId(IRubyEditorActionDefinitionIds.SURROUND_WITH_BEGIN_RESCUE);
+ beginRescueAction.update(selection);
+ provider.addSelectionChangedListener(beginRescueAction);
+ setAction(SurroundWithBeginRescueAction.SURROUND_WTH_BEGIN_RESCUE, beginRescueAction);
+
Action action = new ContentAssistAction(RubyPlugin.getDefault().getPluginProperties(),
"ContentAssistProposal.", this);
action.setActionDefinitionId(IRubyEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
@@ -262,34 +289,15 @@
action.setActionDefinitionId(IRubyEditorActionDefinitionIds.OPEN_STRUCTURE);
setAction(IRubyEditorActionDefinitionIds.OPEN_STRUCTURE, action);
PlatformUI.getWorkbench().getHelpSystem().setHelp(action, IRubyHelpContextIds.OPEN_STRUCTURE_ACTION);
+
+ action= new TextOperationAction(RubyEditorMessages.getBundleForConstructedKeys(),"OpenHierarchy.", this, RubySourceViewer.SHOW_HIERARCHY, true); //$NON-NLS-1$
+ action.setActionDefinitionId(IRubyEditorActionDefinitionIds.OPEN_HIERARCHY);
+ setAction(IRubyEditorActionDefinitionIds.OPEN_HIERARCHY, action);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(action, IRubyHelpContextIds.OPEN_HIERARCHY_ACTION);
action = new FormatAction(RubyPlugin.getDefault().getPluginProperties(), "FormatAction.", this);
action.setActionDefinitionId(IRubyEditorActionDefinitionIds.FORMAT);
setAction("Format", action);
-
- ActionGroup oeg, rsg;
- fActionGroups= new CompositeActionGroup(new ActionGroup[] {
- oeg= new OpenEditorActionGroup(this),
- rsg= new RubySearchActionGroup(this)
- });
- fContextMenuGroup= new CompositeActionGroup(new ActionGroup[] {oeg, rsg});
-
- fFoldingGroup= new FoldingActionGroup(this, getViewer());
-
- ISelectionProvider provider= getSite().getSelectionProvider();
- ISelection selection= provider.getSelection();
-
- ResourceAction resAction= new TextOperationAction(RubyEditorMessages.getBundleForConstructedKeys(), "ShowRDoc.", this, ISourceViewer.INFORMATION, true); //$NON-NLS-1$
- resAction= new InformationDispatchAction(RubyEditorMessages.getBundleForConstructedKeys(), "ShowRDoc.", (TextOperationAction) resAction); //$NON-NLS-1$
- resAction.setActionDefinitionId(IRubyEditorActionDefinitionIds.SHOW_RDOC);
- setAction("ShowRDoc", resAction); //$NON-NLS-1$
- PlatformUI.getWorkbench().getHelpSystem().setHelp(resAction, IRubyHelpContextIds.SHOW_JAVADOC_ACTION);
-
- SurroundWithBeginRescueAction beginRescueAction = new SurroundWithBeginRescueAction(this);
- beginRescueAction.setActionDefinitionId(IRubyEditorActionDefinitionIds.SURROUND_WITH_BEGIN_RESCUE);
- beginRescueAction.update(selection);
- provider.addSelectionChangedListener(beginRescueAction);
- setAction(SurroundWithBeginRescueAction.SURROUND_WTH_BEGIN_RESCUE, beginRescueAction);
}
/**
@@ -749,9 +757,26 @@
}
protected void editorContextMenuAboutToShow(IMenuManager menu) {
- super.editorContextMenuAboutToShow(menu);
+ super.editorContextMenuAboutToShow(menu);
- IExtensionRegistry registry = Platform.getExtensionRegistry();
+ menu.insertAfter(IContextMenuConstants.GROUP_OPEN, new GroupMarker(IContextMenuConstants.GROUP_SHOW));
+
+ ActionContext context= new ActionContext(getSelectionProvider().getSelection());
+ fContextMenuGroup.setContext(context);
+ fContextMenuGroup.fillContextMenu(menu);
+ fContextMenuGroup.setContext(null);
+
+ // Quick views
+ IAction action= getAction(IRubyEditorActionDefinitionIds.SHOW_OUTLINE);
+ menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action);
+ action= getAction(IRubyEditorActionDefinitionIds.OPEN_HIERARCHY);
+ menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action);
+
+ addExtensionMenuItems(menu);
+ }
+
+ private void addExtensionMenuItems(IMenuManager menu) {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry
.getExtensionPoint("org.rubypeople.rdt.ui.editorPopupExtender");
IExtension[] extensions = extensionPoint.getExtensions();
@@ -782,22 +807,8 @@
}
}
}
+ }
-
- menu.insertAfter(IContextMenuConstants.GROUP_OPEN, new GroupMarker(IContextMenuConstants.GROUP_SHOW));
-
- ActionContext context= new ActionContext(getSelectionProvider().getSelection());
- fContextMenuGroup.setContext(context);
- fContextMenuGroup.fillContextMenu(menu);
- fContextMenuGroup.setContext(null);
-
- // Quick views
- IAction action= getAction(IRubyEditorActionDefinitionIds.SHOW_OUTLINE);
- menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action);
-// action= getAction(IRubyEditorActionDefinitionIds.OPEN_HIERARCHY);
-// menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action);
- }
-
protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
super.handlePreferenceStoreChanged(event);
String property = event.getProperty();
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/RubyActionGroup.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/RubyActionGroup.java 2007-07-23 19:30:39 UTC (rev 2822)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/RubyActionGroup.java 2007-07-23 20:47:23 UTC (rev 2823)
@@ -1,39 +1,127 @@
package org.rubypeople.rdt.ui.actions;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.ui.actions.ActionGroup;
+import org.eclipse.ui.texteditor.IUpdate;
import org.rubypeople.rdt.internal.ui.rubyeditor.RubyEditor;
public class RubyActionGroup extends ActionGroup {
- public static final String RUBY_SOURCE_SEPARATOR = "ruby.source.separator";
- protected RubyEditor editor;
- protected String menuGroupId;
+
+ /**
+ * Pop-up menu: id of the source sub menu (value <code>org.rubypeople.rdt.ui.source.menu</code>).
+ *
+ * @since 1.0
+ */
+ public static final String MENU_ID= "org.rubypeople.rdt.ui.source.menu"; //$NON-NLS-1$
+
+ /**
+ * Pop-up menu: id of the generate group of the source sub menu (value
+ * <code>generateGroup</code>).
+ *
+ * @since 1.0
+ */
+ public static final String GROUP_GENERATE= "generateGroup"; //$NON-NLS-1$
- public RubyActionGroup(RubyEditor editor, String menuGroupId) {
- this.editor = editor;
- this.menuGroupId = menuGroupId;
+ /**
+ * Pop-up menu: id of the code group of the source sub menu (value
+ * <code>codeGroup</code>).
+ *
+ * @since 1.0
+ */
+ public static final String GROUP_CODE= "codeGroup"; //$NON-NLS-1$
+
+ /**
+ * Pop-up menu: id of the comment group of the source sub menu (value
+ * <code>commentGroup</code>).
+ *
+ * TODO: Make API
+ */
+ private static final String GROUP_COMMENT= "commentGroup"; //$NON-NLS-1$
+
+ /**
+ * Pop-up menu: id of the edit group of the source sub menu (value
+ * <code>editGroup</code>).
+ *
+ * TODO: Make API
+ */
+ public static final String GROUP_EDIT= "editGroup"; //$NON-NLS-1$
+
+ private RubyEditor fEditor;
+ private String fGroupName;
+
+ public RubyActionGroup(RubyEditor editor, String groupName) {
+ fEditor= editor;
+ fGroupName= groupName;
}
public void fillContextMenu(IMenuManager menu) {
super.fillContextMenu(menu);
- IMenuManager rubySourceMenu = getRubySourceMenu(menu);
- rubySourceMenu.insertBefore(RUBY_SOURCE_SEPARATOR, editor.getAction("SurroundWithBeginRescue"));
- rubySourceMenu.insertBefore(RUBY_SOURCE_SEPARATOR, editor.getAction("ToggleComment"));
- rubySourceMenu.insertBefore(RUBY_SOURCE_SEPARATOR, editor.getAction("Comment"));
- rubySourceMenu.insertBefore(RUBY_SOURCE_SEPARATOR, editor.getAction("Uncomment"));
- rubySourceMenu.insertBefore(RUBY_SOURCE_SEPARATOR, editor.getAction("Format"));
+ String menuText= "Source";//ActionMessages.SourceMenu_label;
+// if (fQuickAccessAction != null) {
+// menuText= fQuickAccessAction.addShortcut(menuText);
+// }
+ IMenuManager subMenu= new MenuManager(menuText, MENU_ID);
+ int added= 0;
+ if (isEditorOwner()) {
+ added= fillEditorSubMenu(subMenu);
+ } else {
+ added= fillViewSubMenu(subMenu);
+ }
+ if (added > 0)
+ menu.appendToGroup(fGroupName, subMenu);
}
+
+ private int fillEditorSubMenu(IMenuManager source) {
+ int added= 0;
+ source.add(new Separator(GROUP_COMMENT));
+ added+= addEditorAction(source, "ToggleComment"); //$NON-NLS-1$
+ added+= addEditorAction(source, "AddBlockComment"); //$NON-NLS-1$
+ added+= addEditorAction(source, "RemoveBlockComment"); //$NON-NLS-1$
+ source.add(new Separator(GROUP_EDIT));
+ added+= addEditorAction(source, "Indent"); //$NON-NLS-1$
+ added+= addEditorAction(source, "Format"); //$NON-NLS-1$
+ added+= addEditorAction(source, "SurroundWithBeginRescue"); //$NON-NLS-1$
+ source.add(new Separator(GROUP_GENERATE));
+ source.add(new Separator(GROUP_CODE));
+ return added;
+ }
- public static IMenuManager getRubySourceMenu(IMenuManager menu) {
-
- IMenuManager sourceMenu = menu.findMenuUsingPath("ruby.source");
- if (sourceMenu == null) {
- sourceMenu = new MenuManager("Source", "ruby.source");
- sourceMenu.add(new Separator(RUBY_SOURCE_SEPARATOR));
- menu.insertAfter("group.edit", sourceMenu);
+ private int fillViewSubMenu(IMenuManager source) {
+ int added= 0;
+ source.add(new Separator(GROUP_COMMENT));
+ source.add(new Separator(GROUP_EDIT));
+ source.add(new Separator(GROUP_GENERATE));
+ source.add(new Separator(GROUP_CODE));
+ return added;
+ }
+
+ private int addAction(IMenuManager menu, IAction action) {
+ if (action != null && action.isEnabled()) {
+ menu.add(action);
+ return 1;
}
- return sourceMenu;
+ return 0;
+ }
+
+ private int addEditorAction(IMenuManager menu, String actionID) {
+ if (fEditor == null)
+ return 0;
+ IAction action= fEditor.getAction(actionID);
+ if (action == null)
+ return 0;
+ if (action instanceof IUpdate)
+ ((IUpdate)action).update();
+ if (action.isEnabled()) {
+ menu.add(action);
+ return 1;
+ }
+ return 0;
}
+
+ private boolean isEditorOwner() {
+ return fEditor != null;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|