diff --git a/sqldeveloper/extension/.gitignore b/sqldeveloper/extension/.gitignore index 8f5ab22f..3622279e 100644 --- a/sqldeveloper/extension/.gitignore +++ b/sqldeveloper/extension/.gitignore @@ -1 +1,2 @@ **/*.md.html +/built/ diff --git a/sqldeveloper/extension/README.md b/sqldeveloper/extension/README.md index ebaf44f2..4bb4f935 100644 --- a/sqldeveloper/extension/README.md +++ b/sqldeveloper/extension/README.md @@ -4,6 +4,13 @@ You can add new folders and nodes to navigators, new actions on objects (*or set Depending on requirements, this can be done in either XML or java and deployed by simply copying an XML file to the appropriate directory, or creating an extension jar -- or *check for updates* bundle for XML and/or java. +### New + +* [XML Based Favorites Example](xml/favorites) + + +* [Example Update Center](https://github.com/bjeffrie/sqldev-update-center) (external) with pre-built cfu bundles for these examples. + ### Contents * [Set Up / Tutorial](./setup.md) - A step by step guide to building your first extension and check for updates bundle. diff --git a/sqldeveloper/extension/build.properties b/sqldeveloper/extension/build.properties index 25162708..6710a9fc 100644 --- a/sqldeveloper/extension/build.properties +++ b/sqldeveloper/extension/build.properties @@ -11,10 +11,10 @@ sqldev.dir=D:/sqldeveloper-18.1.0/sqldeveloper # Information about the company or person creating the extension extension.owner=Oracle Examples extension.owner.desc=Example extensions for SQL Developer -extension.owner.url=https://github.com/oracle/oracle-db-examples/sqldeveloper +extension.owner.url=https://github.com/oracle/oracle-db-examples/tree/master/sqldeveloper/extension # # Base location of the CFU site. # This is where the produced updates.xml will say the cfu bundle files are. -update.url=http://localhost +update.url=https://gitcdn.xyz/repo/bjeffrie/sqldev-update-center/master diff --git a/sqldeveloper/extension/xml/README.md b/sqldeveloper/extension/xml/README.md index 6651de67..cec90487 100644 --- a/sqldeveloper/extension/xml/README.md +++ b/sqldeveloper/extension/xml/README.md @@ -17,10 +17,15 @@ This allows combining a number of xml definitions together as well as the abilit * [individual](individual) Examples for ACTION, EDITOR, NAVIGATOR - + + * [packaged](packaged) XML Examples packaged as an extension.jar - + +* [Simple Favorites](favorites) +XML-Based favorites folders (packaged as an extension.jar) + + * [schema](schema) XML schema for the three extension types. Note that the dialogs(ACTION) schema is heavily annotated and has been run through [xsddoc](http://xframe.sourceforge.net/xsddoc/index.html) to produce javadoc-like documentation [here](http://xmlns.oracle.com/sqldeveloper/3_1/dialogs). \ No newline at end of file diff --git a/sqldeveloper/extension/xml/favorites/README.md b/sqldeveloper/extension/xml/favorites/README.md new file mode 100644 index 00000000..d27895bf --- /dev/null +++ b/sqldeveloper/extension/xml/favorites/README.md @@ -0,0 +1,53 @@ +# [SQL Developer](http://www.oracle.com/technetwork/developer-tools/sql-developer/) Examples +## Simple Favorites +XML-Based favorites folders (packaged as an extension.jar) + +This extension ands the ability to manage and use a simple favorites table in the connection schema (or available via public synonym from another). + +### First, The Ugly + +* Because of the simplistic design, creating the table and adding favorites will require issuing a commit on the current connection. All actions state this explicitly and indicate if there are transactions pending. + + +* In order for the objects in a favorites folder to behave as the real thing, a separate query must be used for each object type. This example includes all 50+ of the types shown in an Oracle connection navigator. I encourage you to remove the types you do not care about from favorites_nav.xml & favorites_actions.xml if the performance is an issue. + + +* Since the objects in a favorites folder act as the real object, you can delete a favorites folder via context menu from the tree but will need to use SQL or the data viewer on the raw SQX$FAVORITES table to remove favorites from a folder. + + +* Since the focus is on the object you are adding to favorites, the favorites tree will not update automatically. You will need to manually update the favorites / folder node to see the newly added object references. + +### Now The Good + +* It's pretty darn useful even with the limitations! + +* After installing the extension or using one of the [manual methods](../../xml) to register the raw XML files, use the context menu on an open connection to create the favorites table. +![Create Favorites Table image](images/CreateFavoritesTable.png) ![Favorites Table Created image](images/FavoritesTableCreated.png) + + +* The context menu on Favorites allows you to add folders or drop the favorites table. +![Add Favorites Folder image](images/AddFavoritesFolder.png) ![After Add Favorites Folder image](images/AfterAddFavoritesFolder.png) + + +* The context menu on any object declared in favorites_actions.xml will have an add to favorites option. Choosing a favorites folder to put it in is required. +![Add To Favorites image](images/AddToFavorites.png) ![Add To Favorites Succeeded image](images/AddToFavoritesSucceeded.png) ![After Add To Favorites image](images/AfterAddToFavorites.png) + + +* Note that since favorites is declared for connType="Oracle", it will "follow you" as you navigate to / add to favorites from the Other Users tree nodes. +![After Add To Favorites image 2](images/AfterAddToFavorites2.png) + +### And Lastly +Given the interest this has generated, I am looking at doing a java working sets style version to overcome the ugly aspects of this one. Perhaps as a hands on lab or OBE kind of series. + + +I welcome feedback on this example and ideas for desirable features of a potential working sets version at [my fork](https://github.com/bjeffrie/oracle-db-examples) of the examples repository. + + +#### The changes I see needing are: +* Separate navigator / connection / repository for working sets. (I.e., similar to migrations or unit testing so the current connection is not impacted.) +* Much more efficient declaration and handling of favorites folder contents and actions. +* Being able to manipulate favorites references from the tree (delete specifically but maybe also drag / drop operations) +* Updating the favorites hierarchy when adding new references. +* Favorites folder nesting? Unlimited or? + + \ No newline at end of file diff --git a/sqldeveloper/extension/xml/favorites/build.properties b/sqldeveloper/extension/xml/favorites/build.properties new file mode 100644 index 00000000..ffa86e2f --- /dev/null +++ b/sqldeveloper/extension/xml/favorites/build.properties @@ -0,0 +1,4 @@ +extension.id=oracle.db.examples.sqldeveloper.extension.favorites +extension.name=Oracle SQL Developer - Simple Favorites Support +extension.descr=Extension to add simple favorites. See https://github.com/bjeffrie/oracle-db-examples/tree/master/sqldeveloper/extension/xml/favorites for usage information and caveats. +extension.version=18.3.0 diff --git a/sqldeveloper/extension/xml/favorites/build.xml b/sqldeveloper/extension/xml/favorites/build.xml new file mode 100644 index 00000000..3b31ddcb --- /dev/null +++ b/sqldeveloper/extension/xml/favorites/build.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sqldeveloper/extension/xml/favorites/built/gen-src/oracle/db/examples/sqldeveloper/extension/favorites/FavoritesResources.java b/sqldeveloper/extension/xml/favorites/built/gen-src/oracle/db/examples/sqldeveloper/extension/favorites/FavoritesResources.java new file mode 100644 index 00000000..a294aa85 --- /dev/null +++ b/sqldeveloper/extension/xml/favorites/built/gen-src/oracle/db/examples/sqldeveloper/extension/favorites/FavoritesResources.java @@ -0,0 +1,72 @@ +// Generated File. Do Not Modify +/* +Copyright (c) 2008,2017, Oracle and/or its affiliates. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package oracle.db.examples.sqldeveloper.extension.favorites; + +import java.awt.Image; +import javax.swing.Icon; + +import oracle.dbtools.raptor.utils.MessagesBase; + +public class FavoritesResources extends MessagesBase { + // Generated Resource Keys + public static final String favorites_folder_label = "favorites_folder_label"; //$NON-NLS-1$ + + private static final String BUNDLE_NAME = "oracle.db.examples.sqldeveloper.extension.favorites.FavoritesResources"; //$NON-NLS-1$ + + private static final FavoritesResources INSTANCE = new FavoritesResources(); + + private FavoritesResources() { + super(BUNDLE_NAME, FavoritesResources.class.getClassLoader()); + } + +// public static ResourceBundle getBundle() { +// return INSTANCE.getResourceBundle(); +// } + +// /** +// * @deprecated use getBundle() +// */ +// public static ResourceBundle getInstance() { +// return getBundle(); + // } + + public static String getString( String key ) { + return INSTANCE.getStringImpl(key); + } + + public static String get( String key ) { + return getString(key); + } + + public static Image getImage( String key ) { + return INSTANCE.getImageImpl(key); + } + + public static String format(String key, Object ... arguments) { + return INSTANCE.formatImpl(key, arguments); + } + + public static Icon getIcon(String key) { + return INSTANCE.getIconImpl(key); + } + + public static Integer getInteger(String key) { + return INSTANCE.getIntegerImpl(key); + } + +} diff --git a/sqldeveloper/extension/xml/favorites/etc/extension.xml b/sqldeveloper/extension/xml/favorites/etc/extension.xml new file mode 100644 index 00000000..65de815e --- /dev/null +++ b/sqldeveloper/extension/xml/favorites/etc/extension.xml @@ -0,0 +1,39 @@ + + + @@extension.name@@ + Oracle Corporation + + + db-category + @@extension.name@@ + @@extension.descr@@ + + + + + + + + + + + + /oracle/db/examples/sqldeveloper/extension/favorites/navigator/xml/favorites_nav.xml + + + + + + + + + + + + + + + diff --git a/sqldeveloper/extension/xml/favorites/images/AddFavoritesFolder.png b/sqldeveloper/extension/xml/favorites/images/AddFavoritesFolder.png new file mode 100644 index 00000000..d9110ad7 Binary files /dev/null and b/sqldeveloper/extension/xml/favorites/images/AddFavoritesFolder.png differ diff --git a/sqldeveloper/extension/xml/favorites/images/AddToFavorites.png b/sqldeveloper/extension/xml/favorites/images/AddToFavorites.png new file mode 100644 index 00000000..3c985824 Binary files /dev/null and b/sqldeveloper/extension/xml/favorites/images/AddToFavorites.png differ diff --git a/sqldeveloper/extension/xml/favorites/images/AddToFavoritesSucceeded.png b/sqldeveloper/extension/xml/favorites/images/AddToFavoritesSucceeded.png new file mode 100644 index 00000000..baa611ca Binary files /dev/null and b/sqldeveloper/extension/xml/favorites/images/AddToFavoritesSucceeded.png differ diff --git a/sqldeveloper/extension/xml/favorites/images/AfterAddFavoritesFolder.png b/sqldeveloper/extension/xml/favorites/images/AfterAddFavoritesFolder.png new file mode 100644 index 00000000..b20b4d44 Binary files /dev/null and b/sqldeveloper/extension/xml/favorites/images/AfterAddFavoritesFolder.png differ diff --git a/sqldeveloper/extension/xml/favorites/images/AfterAddToFavorites.png b/sqldeveloper/extension/xml/favorites/images/AfterAddToFavorites.png new file mode 100644 index 00000000..faac1a0e Binary files /dev/null and b/sqldeveloper/extension/xml/favorites/images/AfterAddToFavorites.png differ diff --git a/sqldeveloper/extension/xml/favorites/images/AfterAddToFavorites2.png b/sqldeveloper/extension/xml/favorites/images/AfterAddToFavorites2.png new file mode 100644 index 00000000..82955705 Binary files /dev/null and b/sqldeveloper/extension/xml/favorites/images/AfterAddToFavorites2.png differ diff --git a/sqldeveloper/extension/xml/favorites/images/CreateFavoritesTable.png b/sqldeveloper/extension/xml/favorites/images/CreateFavoritesTable.png new file mode 100644 index 00000000..b4d723ac Binary files /dev/null and b/sqldeveloper/extension/xml/favorites/images/CreateFavoritesTable.png differ diff --git a/sqldeveloper/extension/xml/favorites/images/FavoritesTableCreated.png b/sqldeveloper/extension/xml/favorites/images/FavoritesTableCreated.png new file mode 100644 index 00000000..4fa793c8 Binary files /dev/null and b/sqldeveloper/extension/xml/favorites/images/FavoritesTableCreated.png differ diff --git a/sqldeveloper/extension/xml/favorites/resfiles.properties b/sqldeveloper/extension/xml/favorites/resfiles.properties new file mode 100644 index 00000000..039a2ec4 --- /dev/null +++ b/sqldeveloper/extension/xml/favorites/resfiles.properties @@ -0,0 +1 @@ +oracle.db.examples.sqldeveloper.extension.favorites.FavoritesResources \ No newline at end of file diff --git a/sqldeveloper/extension/xml/favorites/src/oracle/db/examples/sqldeveloper/extension/favorites/FavoritesResources.properties b/sqldeveloper/extension/xml/favorites/src/oracle/db/examples/sqldeveloper/extension/favorites/FavoritesResources.properties new file mode 100644 index 00000000..9be2ef71 --- /dev/null +++ b/sqldeveloper/extension/xml/favorites/src/oracle/db/examples/sqldeveloper/extension/favorites/FavoritesResources.properties @@ -0,0 +1 @@ +favorites_folder_label=Favorites diff --git a/sqldeveloper/extension/xml/favorites/src/oracle/db/examples/sqldeveloper/extension/favorites/action/xml/favorites_actions.xml b/sqldeveloper/extension/xml/favorites/src/oracle/db/examples/sqldeveloper/extension/favorites/action/xml/favorites_actions.xml new file mode 100644 index 00000000..517ccdb4 --- /dev/null +++ b/sqldeveloper/extension/xml/favorites/src/oracle/db/examples/sqldeveloper/extension/favorites/action/xml/favorites_actions.xml @@ -0,0 +1,1320 @@ + + + + + + + + + Create Favorites Table... + Create a favorites (SDX$FAVTORITES) table in the current schema to hold favorites folders and object references. + oracle.ide.resource.IdeArb:RENAME_ICON + +