diff options
Diffstat (limited to 'bundles/org.eclipse.team.ui')
207 files changed, 0 insertions, 19085 deletions
diff --git a/bundles/org.eclipse.team.ui/.classpath b/bundles/org.eclipse.team.ui/.classpath deleted file mode 100644 index 065ac06e1..000000000 --- a/bundles/org.eclipse.team.ui/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/bundles/org.eclipse.team.ui/.cvsignore b/bundles/org.eclipse.team.ui/.cvsignore deleted file mode 100644 index ba077a403..000000000 --- a/bundles/org.eclipse.team.ui/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/bundles/org.eclipse.team.ui/.project b/bundles/org.eclipse.team.ui/.project deleted file mode 100644 index 340fab81e..000000000 --- a/bundles/org.eclipse.team.ui/.project +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.team.ui</name> - <comment></comment> - <projects> - <project>org.eclipse.compare</project> - <project>org.eclipse.core.boot</project> - <project>org.eclipse.core.resources</project> - <project>org.eclipse.core.runtime</project> - <project>org.eclipse.core.runtime.compatibility</project> - <project>org.eclipse.jface.text</project> - <project>org.eclipse.team.core</project> - <project>org.eclipse.ui</project> - <project>org.eclipse.ui.editors</project> - <project>org.eclipse.ui.forms</project> - <project>org.eclipse.ui.ide</project> - <project>org.eclipse.ui.views</project> - <project>org.eclipse.ui.workbench.texteditor</project> - <project>org.eclipse.update.ui.forms</project> - </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.jdt.core.javanature</nature> - <nature>org.eclipse.pde.PluginNature</nature> - </natures> -</projectDescription> diff --git a/bundles/org.eclipse.team.ui/DESIGN.TXT b/bundles/org.eclipse.team.ui/DESIGN.TXT deleted file mode 100644 index 91dffbe4a..000000000 --- a/bundles/org.eclipse.team.ui/DESIGN.TXT +++ /dev/null @@ -1,93 +0,0 @@ -
-======================
- core
-======================
-SyncInfo
-- represents relative sync of local and remote gives access to resources
-
-TeamSubscriber
-- creates sync infos
-
-SyncInfoSet/MutableSyncInfoSet (optimized collection of sync infos - immutable)
-
-SyncInfoFilter (filtering of sync sets used by actions and creation of sync sets)
-
-SyncInfoCollector (collects sync infos from subscriber, and optionally from workspace. Uses background thread to collect and calculate changes. Is updated automatically with changes)
-
-FilteredSyncInfoSet (filters a provided sync info set with a given filter and possible roots)
-
-======================
- ui
-======================
-
-ISynchronizeManager (manages the lifesycle of synchronize participants)
-
-ISynchronizeView
-
-ISynchronizeParticipant (shows in the sync view, has a mode, working set, and creates a page with the UI pieces)
-
-Modes in sync view (DirectionFilterActionGroup)
-
-SyncInfoSetCompareConfiguration (encapsulates navigation, menus, content, label providers)this
- is used to configure a viewer in different ways based on it's use.
-
-SyncInfoDiffTreeViewer/SyncInfoDiffCheckboxViewer (shows diff nodes)
-
-SyncInfoDiffNode -> DiffNode
-
-SyncInfoSetCompareInput
-
-
-
-DiffNode
-SyncInfoDiffNode
-
-Viewer
-ContentProvider
-Sorter
-LabelProvider
-ViewerInput
-
-1. sync set is created
-2. decide how to model the sync set (hierachy, compressed, change log...) sorter...
-3. hook up chagnen listener
-4. ensure model doesn't change while building it?
-5. update model dynamically
-6. dispose of listener when input changes
-
-SuperCharged MVC
-================
-
-Sync Set Compare Input (displays a diff tree viewer with the compare panes)
-
-Sync Info Compare Input (displays a compare pane for one sync info)
-
-Viewer (viewers) -> view configurators (menus, content provider, label provider, controller)
-
-Viewer Model (diff nodes) logical structure of sync info
-
-Viewer Input (creates viewer model, keeps it up-to-date, sorter)
-
-Data (sync info, sync info set)
-
-1. when does the viewer model get created, it is implementation dependant
-2. why is creating the viewer model takes a while.
-
-How is progress shown?
-======================
-
-1. actions that run jobs that affect a view's content should schedule in the view
- - object contributions, or delegates get this for free via SubscriberAction which
- has a schedule which will schedule via the associated IWorkbenchPart.
- - actions programatically added to a view should be initialized with the view part or view site
- so that it can run the job in the view's context.
- - this will get you (1) the view icon change hint, (2) the half-busy cursor
-2. jobs should provide meaningful progress shown in progress view
- - this will get you (1) a job listed in the progress support showing that something is happening
-3. if working on syncinfodiffnodes in the background you can mark the nodes as working as a hint
- to the UI to display them differently (e.g. should make this adapter specific)
- - this will get you (1) nodes in the sync view showing that they are being worked on
-4. Use progress groups in refresh to show remote refresh and sync calculation as one work item.
- - this will get you (1) one entry in the progress view for both the remote refresh and background
- processing of sync states. no more updating sync view message.
-
diff --git a/bundles/org.eclipse.team.ui/TODO-syncview.txt b/bundles/org.eclipse.team.ui/TODO-syncview.txt deleted file mode 100644 index 523df08b3..000000000 --- a/bundles/org.eclipse.team.ui/TODO-syncview.txt +++ /dev/null @@ -1,173 +0,0 @@ -====================================================================== - EXAMPLE TEAM UI API USAGES -====================================================================== -1. embeding sync viewer in dialog/wizard -2. added a new content provider (logical views of sync info changes) -3. adding custom label decorations -4. actions/menus -5. fetching sync info set without instantiating a participant -6. fetch and wait for the event collector to finish processing the changes -7. showing in a diff viewer either a static model (doesn't update when changes occur) or dynamic - -====================================================================== - PR LIST (07-01-2004) -====================================================================== - -x P3 schedule support by participant. - this requires changing the refresh jobs to accept scheduling different jobs. Essentially being able to have an - ordered *queue of refreshes. Also, participant will need a schedule object to encapsulate the schedule logic. - -x P3 status message could be more precise instead of simply "Working". But to do this we need access to the job progress monitor - and it isn't available API from the UI. (removed status in sync view, progress will be shown in the progress shell). - -x P1 end of refresh prompt should be a property change notice, and let the participant decide what to do! - -x P2 decide overview page contents and how it should be used - -x remove duplicated tree/table viewers classes. the orignial ones simply have the INavigable behavior. - -x P1 make changes section only be a pagebook. this would easily allow adding any number of composites to the page? - should look at memory consuption and ensure that we are disposing properly! - -- compareeditorinput fetcheds remote content outside of a progress monitor - -x decorations for SyncInfoDiffElements (of which type.. project persistent property setting?) -x labels for compare editors (text merge viewers and title for diff viewer) - -x generic navigate support for SyncInfoDiffTreeViewer, PRd compare for API support - -x readonly state for compare panes - -- progress support added when fetching (e.g. caching contents in ITypedElement). This will require compare to add some API. - -x INavigable in compare needs to be made API. - -- details dialog needs to create composites once then display them. Or only create once!!!! - -x sync set filtering creation must be more precise. For example you should be able to specify a root and a direction. - -x cvs update/commit action in sync view toolbar are not updating their state anymore :( - -x P3 mode switching at the end of a refresh to ensure that changes are shown if available - -x P2 need an event for adding roots to a subscriber to update the list shown - -x memory and sync set disposal in syncsetcompare input!!!! VERY IMPORTANT!!! - -- overiding outgoing/incoming doesn't show the changes in the commit dialog because the filter is only configured to show in one direction. - -====================================================================== - PR LIST (16-01-2004) -====================================================================== -x progress monitoring in SyncSet.reset and such. there are many places where null progress monitors are passed along. -- showing sync view in commit dialog is complicated because there is no easy way of finding out exactly which resources will be committed at the - point the commit comment dialog is shown. Need to provide new API on the commit dialog for this. -- convert details dialogs that show sync view into wizards, this allows more room to browse the changes. almost like the refactoring. Preview >> button instead of Next >>. -x job status handler API or not?? - -====================================================================== - PR LIST (26-01-2004) -====================================================================== -x navigable APIs must be consolidated, sync view navigation -x compare configuration review -x logical view extensions [not going to do this in 3.0] -x content provider should not assume diff nodes have associated resources - - content provider input? Is it a diff node or sync set? diff node hack required for getting the - compare editor input working. -x viewer input as a diffnode with a sync set seems wrong? -- share reconciling with existing (e.g. using compare contents to resolve) -x comment grouping logical view -- target migration - -====================================================================== - PR LIST (30-01-2004) MV -====================================================================== -x actions in sync view all assume that selection will have a resource (e.g refresh action). - - how would a refresh know what to select if a change comment node was selected, for example - - could first attempt to obtain resource and, if that fails, visit children to obtain resources - [jm] I think that actions will have to know about DiffNodes and we need the helper to - get the list of children nodes. - [jm] added Utils.getResources(Iselection) does all the logic for retreiving resources -x sorter is related to input so may need to change when input does - - there does not appear to be a clean way to change the sorter and input without causing two refreshes -x SyncInfoSet##getOutOfSyncDescendants(IResource) is speced to include the resource itself if it is out-of-sync - - this is a bit confusing as the name implies otherwise - - should either consider a name change or a spec change - [jm] I never understood why is was spec'd like that :) You can decide... -x compare input requires root node to have children or diff viewer is not added - - this is problematic when creating a wizard page that is dynamically populated - - not sure if there's problems caused by returning true when there are no children - [jm] I think this it's fine to have root nodes return true to hasChildren. I don't like - compares subtle way of determining is the diff viewer should be shown, but in our case a - root node can safely always have children. -x several places require a resource - - e.g. conflict propogation requires a resource but shouldn't (modified to work without a resource) - x conflicts do not propogate in comment view [jm] fixed - [jm] we have to change this assumption everywhere! Actions, label decorators... and such. - [jm] does sync info diff node require a resource? currently it does. But I still don't like - the SyncSet methods that take IResource.ROOT to return first level children. -x there are times when the sync set changes but the input hasn't yet and the given input - doesn't handle outgoing changes. For example, when changing from incoming to outgoing with - the change log root, the change log root gets a reset from the sync set then the input - is changed. this can cause an NPE. Must look into the ordering here. - [mv] I think we have to make the statement that the content provider must handle all sync types - in some fashion. I recall that we discussed the restriction that a sync diff root node must - show all elements in it's sync set. Could the comment builder place all outgoing changes in - an additional section. The user would never see this but it would fulfill the contract. - [jm] yes, this is what i ended up doing. - [mv] for efficiency, we should still try to couple the mode change with the content provider - change so that the diff node tree is not built and displayed twice during a change -- the test cases starve the subscriber event handler such that an event has additions and removals for the same resources - - this causes failures in the diff tree builders - - although less likely in UI, can still happen - - need tests for these scenarios to ensure generated event is correct after addition and removal -x there are several places in SyncInfoSet and in the DiffNodes where we must use the workspace root - as the input resource to imply get all members? Maybe this should be cleaned up a bit. -x SyncInfoSet must be cleaned up a lot, the API is vague and method names are not clear. - x we need a way to ensure that the sync set does not change while we are building a diff tree - x events are only fired from endInput(). It should work in both batching and non-batching mode -x SyncInfoDiffNode doesn't have to return a resource or a syncinfo. By definition a diff node already has API - for returning a sync kind getKind() and access to all three resources getRight(), getLeft(), getAncestor(). - -====================================================================== - PR LIST (02-02-2004) MV -====================================================================== -x sync view title says "Summary" when first opened -- would like to show subscriber roots as compressed folders at root of sync view - - sync set needs to have the concept of roots -x How is a reset propogated through the sync set chain. - - I'm concerned that this is adhoc at the moment. we need to make it explicit. -x why must clearModelObjects go deep? Can't you just disconnect from the parent? - -====================================================================== - PR LIST (05-02-2004) MV -====================================================================== -x I notice that SyncInfoDiffNode requires a resource (via assert) and sync info is only obtained from -SyncInfoDiffNodes (in Util). This is problematic as now the diff tree cannot contain diff nodes that -do not map to a resource but parent nodes that do. The selection determination for SubscriberAction -needs to walk the diff node tree for this case. - -====================================================================== - PR LIST (05-02-2004) Jm -====================================================================== -- cvs merge participant doesn't get view progress support because participant is added before -viewer is created. But this should be solvable by ensuring that showInActivePerspective forces -viewer creation in a sync exec. - -============================== -x initialize case doesn't work because main page is shown as empty but mode is correct -x how do we handle changes to sync: re-create new nodes or update the nodes with new sync kind? -x new projects don't show up? -- how does our APIs support moves/renames? Do we need another sync state? - -===== -x status line doesn't show? -- there's a bunch of non-NLSd strings? -- performance scalability with large sets -- initialization feedback when set is populating? -- scenarios/user doc - - most sync state stuff must be tested by automated tests - - progress should have scenarios (expected feedback, init case) - - errors -- resource filtering as seen in Refreshcompletedialog is very ineficient -- can you call start on the collector multiple times?
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/about.html b/bundles/org.eclipse.team.ui/about.html deleted file mode 100644 index 9db411aab..000000000 --- a/bundles/org.eclipse.team.ui/about.html +++ /dev/null @@ -1,30 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<html> -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>20th June, 2002</p> -<h3>License</h3> -<p>Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>. -For purposes of the CPL, "Program" will mean the Content.</p> - -<h3>Contributions</h3> - -<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise -made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such -Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p> - -<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the -host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available -to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also -providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of -the CPL.</p> - -</body> -</html>
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/build.properties b/bundles/org.eclipse.team.ui/build.properties deleted file mode 100644 index a90fcf573..000000000 --- a/bundles/org.eclipse.team.ui/build.properties +++ /dev/null @@ -1,14 +0,0 @@ -############################################################################### -# Copyright (c) 2000, 2003 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Common Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/cpl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -# Eclipse build contribution -bin.includes=about.html,icons/,plugin.xml,plugin.properties,*.jar -source.teamui.jar=src/ -src.includes=about.html,schema/ diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/catchup_rls.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/catchup_rls.gif Binary files differdeleted file mode 100644 index ba8ee00a3..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/catchup_rls.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/catchuprelease_rls.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/catchuprelease_rls.gif Binary files differdeleted file mode 100644 index 25d4c998b..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/catchuprelease_rls.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/checkin_action.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/checkin_action.gif Binary files differdeleted file mode 100644 index b95e26a1b..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/checkin_action.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/checkout_action.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/checkout_action.gif Binary files differdeleted file mode 100644 index 706dc020e..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/checkout_action.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/collapseall.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/collapseall.gif Binary files differdeleted file mode 100644 index 0bae56c34..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/collapseall.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/conflict_synch.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/conflict_synch.gif Binary files differdeleted file mode 100644 index ecde52ea8..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/conflict_synch.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/contents.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/contents.gif Binary files differdeleted file mode 100644 index bb2d85225..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/contents.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/filter_change.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/filter_change.gif Binary files differdeleted file mode 100644 index 1492b4efa..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/filter_change.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/flatLayout.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/flatLayout.gif Binary files differdeleted file mode 100644 index b84df084f..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/flatLayout.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/hierarchicalLayout.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/hierarchicalLayout.gif Binary files differdeleted file mode 100644 index e597c3d16..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/hierarchicalLayout.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/ignorews_edit.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/ignorews_edit.gif Binary files differdeleted file mode 100644 index 097ecdda5..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/ignorews_edit.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/incom_synch.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/incom_synch.gif Binary files differdeleted file mode 100644 index dc9bfc62d..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/incom_synch.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/next_nav.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/next_nav.gif Binary files differdeleted file mode 100644 index 8392f3345..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/next_nav.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/outgo_synch.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/outgo_synch.gif Binary files differdeleted file mode 100644 index afe6b1736..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/outgo_synch.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/prev_nav.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/prev_nav.gif Binary files differdeleted file mode 100644 index 9b278e6fa..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/prev_nav.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/refresh.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/refresh.gif Binary files differdeleted file mode 100644 index a063c230a..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/refresh.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/refresh_remote.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/refresh_remote.gif Binary files differdeleted file mode 100644 index 9597ad7f8..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/refresh_remote.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/release_rls.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/release_rls.gif Binary files differdeleted file mode 100644 index 3162b9373..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/release_rls.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/rem_co.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/rem_co.gif Binary files differdeleted file mode 100644 index 12a9167c5..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/rem_co.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/showsync_rn.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/showsync_rn.gif Binary files differdeleted file mode 100644 index 8411bc227..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/showsync_rn.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/site_element.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/site_element.gif Binary files differdeleted file mode 100644 index 9dd4d8300..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/site_element.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/toggle_layout.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/toggle_layout.gif Binary files differdeleted file mode 100644 index b69c1a48f..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/toggle_layout.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/workingsets.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/workingsets.gif Binary files differdeleted file mode 100644 index f302d8c88..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/clcl16/workingsets.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/cview16/compare_view.gif b/bundles/org.eclipse.team.ui/icons/full/cview16/compare_view.gif Binary files differdeleted file mode 100644 index 41800a0c9..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/cview16/compare_view.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/cview16/synch_synch.gif b/bundles/org.eclipse.team.ui/icons/full/cview16/synch_synch.gif Binary files differdeleted file mode 100644 index c4a11c3cc..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/cview16/synch_synch.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/catchup_rls.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/catchup_rls.gif Binary files differdeleted file mode 100644 index 627c90188..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/catchup_rls.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/catchuprelease_rls.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/catchuprelease_rls.gif Binary files differdeleted file mode 100644 index 125662ffe..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/catchuprelease_rls.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkin_action.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkin_action.gif Binary files differdeleted file mode 100644 index e84103f40..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkin_action.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkout_action.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkout_action.gif Binary files differdeleted file mode 100644 index 4e9a3eb98..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkout_action.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/collapseall.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/collapseall.gif Binary files differdeleted file mode 100644 index 3409b11b3..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/collapseall.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/conflict_synch.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/conflict_synch.gif Binary files differdeleted file mode 100644 index 7c1a8a852..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/conflict_synch.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/contents.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/contents.gif Binary files differdeleted file mode 100644 index c5f90b61b..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/contents.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/filter_change.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/filter_change.gif Binary files differdeleted file mode 100644 index 2b6285b75..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/filter_change.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/flatLayout.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/flatLayout.gif Binary files differdeleted file mode 100644 index aa0160d1c..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/flatLayout.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/hierarchicalLayout.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/hierarchicalLayout.gif Binary files differdeleted file mode 100644 index 76f336003..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/hierarchicalLayout.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/ignorews_edit.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/ignorews_edit.gif Binary files differdeleted file mode 100644 index 8a7dece74..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/ignorews_edit.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/incom_synch.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/incom_synch.gif Binary files differdeleted file mode 100644 index 4221aa488..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/incom_synch.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/next_nav.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/next_nav.gif Binary files differdeleted file mode 100644 index 6cbeced26..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/next_nav.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/outgo_synch.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/outgo_synch.gif Binary files differdeleted file mode 100644 index 14e440b10..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/outgo_synch.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/prev_nav.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/prev_nav.gif Binary files differdeleted file mode 100644 index a3441a062..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/prev_nav.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/refresh.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/refresh.gif Binary files differdeleted file mode 100644 index b2281b40c..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/refresh.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/refresh_remote.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/refresh_remote.gif Binary files differdeleted file mode 100644 index 0f63a2204..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/refresh_remote.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/release_rls.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/release_rls.gif Binary files differdeleted file mode 100644 index 3f2bc7c1e..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/release_rls.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/rem_co.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/rem_co.gif Binary files differdeleted file mode 100644 index 7e0ad4aed..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/rem_co.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/showsync_rn.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/showsync_rn.gif Binary files differdeleted file mode 100644 index 3dcccb3c7..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/showsync_rn.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/toggle_layout.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/toggle_layout.gif Binary files differdeleted file mode 100644 index 4ea29e507..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/toggle_layout.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/workingsets.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/workingsets.gif Binary files differdeleted file mode 100644 index a0f800693..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/dlcl16/workingsets.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/catchup_rls.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/catchup_rls.gif Binary files differdeleted file mode 100644 index 93e221909..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/catchup_rls.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/catchuprelease_rls.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/catchuprelease_rls.gif Binary files differdeleted file mode 100644 index 8898cd608..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/catchuprelease_rls.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/checkin_action.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/checkin_action.gif Binary files differdeleted file mode 100644 index feb14bf53..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/checkin_action.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/checkout_action.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/checkout_action.gif Binary files differdeleted file mode 100644 index 4fdde615d..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/checkout_action.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/collapseall.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/collapseall.gif Binary files differdeleted file mode 100644 index 3409b11b3..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/collapseall.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/conflict_synch.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/conflict_synch.gif Binary files differdeleted file mode 100644 index 8eb28e6d6..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/conflict_synch.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/contents.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/contents.gif Binary files differdeleted file mode 100644 index 151193a0b..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/contents.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/filter_change.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/filter_change.gif Binary files differdeleted file mode 100644 index 537265693..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/filter_change.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/flatLayout.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/flatLayout.gif Binary files differdeleted file mode 100644 index 9f9ca4876..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/flatLayout.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/hierarchicalLayout.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/hierarchicalLayout.gif Binary files differdeleted file mode 100644 index b50b2c38a..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/hierarchicalLayout.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/ignorews_edit.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/ignorews_edit.gif Binary files differdeleted file mode 100644 index b771b21a8..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/ignorews_edit.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/incom_synch.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/incom_synch.gif Binary files differdeleted file mode 100644 index dab07f784..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/incom_synch.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/next_nav.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/next_nav.gif Binary files differdeleted file mode 100644 index 03b7af342..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/next_nav.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/outgo_synch.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/outgo_synch.gif Binary files differdeleted file mode 100644 index c978a2974..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/outgo_synch.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/prev_nav.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/prev_nav.gif Binary files differdeleted file mode 100644 index dd65c5235..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/prev_nav.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/refresh.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/refresh.gif Binary files differdeleted file mode 100644 index 919423d43..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/refresh.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/refresh_remote.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/refresh_remote.gif Binary files differdeleted file mode 100644 index cbafcaacf..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/refresh_remote.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/release_rls.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/release_rls.gif Binary files differdeleted file mode 100644 index 525d8091b..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/release_rls.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/rem_co.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/rem_co.gif Binary files differdeleted file mode 100644 index 310510ee5..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/rem_co.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/showsync_rn.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/showsync_rn.gif Binary files differdeleted file mode 100644 index 4410b22ee..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/showsync_rn.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/toggle_layout.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/toggle_layout.gif Binary files differdeleted file mode 100644 index b69740dfb..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/toggle_layout.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/workingsets.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/workingsets.gif Binary files differdeleted file mode 100644 index 2fddc3ea1..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/elcl16/workingsets.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/obj/compressed_folder_obj.gif b/bundles/org.eclipse.team.ui/icons/full/obj/compressed_folder_obj.gif Binary files differdeleted file mode 100644 index e2b83b811..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/obj/compressed_folder_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/obj/export_projectset.gif b/bundles/org.eclipse.team.ui/icons/full/obj/export_projectset.gif Binary files differdeleted file mode 100644 index ab35990f1..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/obj/export_projectset.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/obj/import_projectset.gif b/bundles/org.eclipse.team.ui/icons/full/obj/import_projectset.gif Binary files differdeleted file mode 100644 index 17cb2e7db..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/obj/import_projectset.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/obj/share_project.gif b/bundles/org.eclipse.team.ui/icons/full/obj/share_project.gif Binary files differdeleted file mode 100644 index 2b73ce2b3..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/obj/share_project.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/ovr/checkedout_ov.gif b/bundles/org.eclipse.team.ui/icons/full/ovr/checkedout_ov.gif Binary files differdeleted file mode 100644 index a11a542b1..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/ovr/checkedout_ov.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/ovr/confchg_ov.gif b/bundles/org.eclipse.team.ui/icons/full/ovr/confchg_ov.gif Binary files differdeleted file mode 100644 index 020fc5438..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/ovr/confchg_ov.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/ovr/dirty_ov.gif b/bundles/org.eclipse.team.ui/icons/full/ovr/dirty_ov.gif Binary files differdeleted file mode 100644 index 07a8c35f3..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/ovr/dirty_ov.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/ovr/version_controlled.gif b/bundles/org.eclipse.team.ui/icons/full/ovr/version_controlled.gif Binary files differdeleted file mode 100644 index a2b345d79..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/ovr/version_controlled.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/ovr/warning_co.gif b/bundles/org.eclipse.team.ui/icons/full/ovr/warning_co.gif Binary files differdeleted file mode 100644 index 3af228cea..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/ovr/warning_co.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/wizban/export_projectset_wizban.gif b/bundles/org.eclipse.team.ui/icons/full/wizban/export_projectset_wizban.gif Binary files differdeleted file mode 100644 index 0b179a95c..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/wizban/export_projectset_wizban.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/wizban/import_projectset_wizban.gif b/bundles/org.eclipse.team.ui/icons/full/wizban/import_projectset_wizban.gif Binary files differdeleted file mode 100644 index 7ebb8362a..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/wizban/import_projectset_wizban.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/icons/full/wizban/share_wizban.gif b/bundles/org.eclipse.team.ui/icons/full/wizban/share_wizban.gif Binary files differdeleted file mode 100644 index 5ce318153..000000000 --- a/bundles/org.eclipse.team.ui/icons/full/wizban/share_wizban.gif +++ /dev/null diff --git a/bundles/org.eclipse.team.ui/plugin.properties b/bundles/org.eclipse.team.ui/plugin.properties deleted file mode 100644 index ead44fbe3..000000000 --- a/bundles/org.eclipse.team.ui/plugin.properties +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################### -# Copyright (c) 2000, 2003 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Common Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/cpl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -providerName=Eclipse.org -pluginName=Team Support UI - -Team=Team -configurationWizards=Configuration Wizards -synchronizeParticipants=Synchronize View Participants -logicalViews=Logical Synchronize Views - -TeamPreferencePage.name=Team -TextPreferencePage.name=File Content -IgnorePreferencePage.name=Ignored Resources - -ConfigureProject.label=&Share Project... -ConfigureProject.tooltip=Share the project with others using a version and configuration management system. - -TeamGroupMenu.label=T&eam -Team.viewCategory=Team - -Synchronizing.perspective=Team Synchronizing -SyncView.name=Synchronize - -ProjectSetImportWizard.name=Team Project Set -ProjectSetImportWizard.description=A wizard that imports a Team Project Set -ProjectSetExportWizard.name=Team Project Set -ProjectSetExportWizard.description=A wizard that exports a Team Project Set - -Command.category.name=Team -Command.category.description=Actions that apply when working with a Team -Command.syncAll.name=Synchronize -Command.syncAll.description=Synchronize - -CompressFolderView.name=Compress Folders -CompressFolderView.description=Compress in-sync folders paths diff --git a/bundles/org.eclipse.team.ui/plugin.xml b/bundles/org.eclipse.team.ui/plugin.xml deleted file mode 100644 index 78affbe5e..000000000 --- a/bundles/org.eclipse.team.ui/plugin.xml +++ /dev/null @@ -1,238 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.0"?> -<plugin - id="org.eclipse.team.ui" - name="%pluginName" - version="3.0.0" - provider-name="%providerName" - class="org.eclipse.team.internal.ui.TeamUIPlugin"> - - <runtime> - <library name="teamui.jar"> - <export name="*"/> - <packages prefixes="org.eclipse.team.ui, org.eclipse.team.internal.ui"/> - </library> - </runtime> - <requires> - <import plugin="org.eclipse.ui.ide" optional="true"/> - <import plugin="org.eclipse.ui.views" optional="true"/> - <import plugin="org.eclipse.jface.text" optional="true"/> - <import plugin="org.eclipse.ui.workbench.texteditor" optional="true"/> - <import plugin="org.eclipse.ui.editors" optional="true"/> - <import plugin="org.eclipse.core.resources"/> - <import plugin="org.eclipse.core.runtime.compatibility" optional="true"/> - <import plugin="org.eclipse.team.core"/> - <import plugin="org.eclipse.ui"/> - <import plugin="org.eclipse.compare"/> - <import plugin="org.eclipse.ui.forms"/> - </requires> - - - <extension-point id="configurationWizards" name="%configurationWizards" schema="schema/configurationWizards.exsd"/> - <extension-point id="synchronizeParticipants" name="%synchronizeParticipants" schema="schema/synchronizeParticipants.exsd"/> - <extension-point id="logicalViews" name="%logicalViews" schema="schema/logicalViews.exsd"/> - -<!-- **************** PREFERENCES ******************* --> - <extension - point="org.eclipse.ui.preferencePages"> - <page - name="%TeamPreferencePage.name" - class="org.eclipse.team.internal.ui.preferences.SyncViewerPreferencePage" - id="org.eclipse.team.ui.TeamPreferences"> - </page> - <page - name="%TextPreferencePage.name" - category="org.eclipse.team.ui.TeamPreferences" - class="org.eclipse.team.internal.ui.preferences.TextPreferencePage" - id="org.eclipse.team.ui.TextPreferences"> - </page> - <page - name="%IgnorePreferencePage.name" - category="org.eclipse.team.ui.TeamPreferences" - class="org.eclipse.team.internal.ui.preferences.IgnorePreferencePage" - id="org.eclipse.team.ui.IgnorePreferences"> - </page> - </extension> -<!-- ****************** POPUP ACTIONS *************** --> - <extension - point="org.eclipse.ui.popupMenus"> - <objectContribution - objectClass="org.eclipse.core.resources.IResource" - adaptable="true" - id="org.eclipse.team.ui.ResourceContributions"> - <menu - label="%TeamGroupMenu.label" - path="additions" - id="team.main"> - <separator - name="group1"> - </separator> - <separator - name="group2"> - </separator> - <separator - name="group3"> - </separator> - <separator - name="group4"> - </separator> - <separator - name="group5"> - </separator> - <separator - name="group6"> - </separator> - <separator - name="group7"> - </separator> - <separator - name="group8"> - </separator> - <separator - name="group9"> - </separator> - <separator - name="group10"> - </separator> - <separator - name="targetGroup"> - </separator> - <separator - name="projectGroup"> - </separator> - </menu> - </objectContribution> - <objectContribution - objectClass="org.eclipse.core.resources.IProject" - adaptable="true" - id="org.eclipse.team.ui.ProjectContributions"> - <action - label="%ConfigureProject.label" - tooltip="%ConfigureProject.tooltip" - class="org.eclipse.team.internal.ui.actions.ConfigureProjectAction" - menubarPath="team.main/projectGroup" - enablesFor="1" - id="org.eclipse.team.ui.ConfigureProject"> - </action> - </objectContribution> - </extension> -<!-- ************** Views ********************** --> - <extension - point="org.eclipse.ui.views"> - <category - name="%Team.viewCategory" - id="org.eclipse.team.ui"> - </category> - <view - name="%SyncView.name" - icon="icons/full/cview16/synch_synch.gif" - fastViewWidthRatio="0.25" - category="org.eclipse.team.ui" - class="org.eclipse.team.internal.ui.synchronize.SynchronizeView" - id="org.eclipse.team.sync.views.SynchronizeView"> - </view> - </extension> -<!-- **************** Synchronizing Perspective ******************* --> - <extension - point="org.eclipse.ui.perspectives"> - <perspective - name="%Synchronizing.perspective" - label="%Synchronizing.perspective" - icon="icons/full/cview16/synch_synch.gif" - class="org.eclipse.team.internal.ui.synchronize.TeamSynchronizingPerspective" - id="org.eclipse.team.ui.TeamSynchronizingPerspective"> - </perspective> - </extension> - <extension - point="org.eclipse.ui.perspectiveExtensions"> - <perspectiveExtension - targetID="org.eclipse.ui.resourcePerspective"> - <perspectiveShortcut - id="org.eclipse.team.ui.TeamSynchronizingPerspective"> - </perspectiveShortcut> - </perspectiveExtension> - </extension> -<!-- ****************** Import Wizards ********************* --> - <extension - point="org.eclipse.ui.importWizards"> - <wizard - name="%ProjectSetImportWizard.name" - icon="icons/full/obj/import_projectset.gif" - class="org.eclipse.team.internal.ui.wizards.ProjectSetImportWizard" - id="org.eclipse.team.ui.ProjectSetImportWizard"> - <description> - %ProjectSetImportWizard.description - </description> - <selection - class="org.eclipse.core.resources.IProject"> - </selection> - </wizard> - </extension> -<!-- ****************** Export Wizards ********************* --> - <extension - point="org.eclipse.ui.exportWizards"> - <wizard - name="%ProjectSetExportWizard.name" - icon="icons/full/obj/export_projectset.gif" - class="org.eclipse.team.internal.ui.wizards.ProjectSetExportWizard" - id="org.eclipse.team.ui.ProjectSetExportWizard"> - <description> - %ProjectSetExportWizard.description - </description> - <selection - class="org.eclipse.core.resources.IProject"> - </selection> - </wizard> - </extension> -<!-- ***************** Perspective Extensions ********************** --> - <extension - point="org.eclipse.ui.perspectiveExtensions"> - <perspectiveExtension - targetID="org.eclipse.team.ui.TeamSynchronizingPerspective"> - <showInPart - id="org.eclipse.ui.views.ResourceNavigator"> - </showInPart> - </perspectiveExtension> - </extension> -<!-- ***************** Actions ********************** --> - <extension - point="org.eclipse.ui.commands"> - <category - name="%Command.category.name" - description="%Command.category.description" - id="org.eclipse.team.ui.category.team"> - </category> - <command - name="%Command.syncAll.name" - category="org.eclipse.team.ui.category.team" - description="%Command.syncAll.description" - id="org.eclipse.team.ui.synchronizeAll"> - </command> - <keyBinding - string="" - scope="org.eclipse.ui.globalScope" - command="org.eclipse.team.ui.synchronizeAll" - configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> - </keyBinding> - </extension> -<!-- action sets --> - <extension - point="org.eclipse.ui.actionSets"> - <actionSet - label="%Command.category.name" - description="%Command.category.description" - visible="true" - id="org.eclipse.team.ui.actionSet"> - <action - label="%Command.syncAll.name" - pulldown="true" - style="pulldown" - icon="icons/full/cview16/synch_synch.gif" - class="org.eclipse.team.internal.ui.synchronize.actions.GlobalRefreshAction" - toolbarPath="Normal/Team" - id="org.eclipse.team.ui.synchronizeAll"> - </action> - </actionSet> - </extension> - -</plugin> diff --git a/bundles/org.eclipse.team.ui/schema/configurationWizards.exsd b/bundles/org.eclipse.team.ui/schema/configurationWizards.exsd deleted file mode 100644 index 944ede91e..000000000 --- a/bundles/org.eclipse.team.ui/schema/configurationWizards.exsd +++ /dev/null @@ -1,142 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Schema file written by PDE --> -<schema targetNamespace="org.eclipse.team.ui"> -<annotation> - <appInfo> - <meta.schema plugin="org.eclipse.team.ui" id="configurationWizards" name="Configuration Wizards"/> - </appInfo> - <documentation> - This extension point is used to register a method for configuration of a project. -Configuration involves the association of a project with a team provider, including all information necessary to initialize -that team provider, including such things as username, password, and any relevant information necessary to locate the provider. -<p> -Providers may provide an extension for this extension point, and an implementation of <samp>org.eclipse.team.ui.IConfigurationWizard</samp> -which gathers the necessary information and configures the projects. - </documentation> - </annotation> - - <element name="extension"> - <complexType> - <sequence> - <element ref="wizard" minOccurs="0" maxOccurs="1"/> - </sequence> - <attribute name="point" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="id" type="string"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="name" type="string"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - </complexType> - </element> - - <element name="wizard"> - <annotation> - <appInfo> - <meta.element labelAttribute="name"/> - </appInfo> - </annotation> - <complexType> - <attribute name="name" type="string" use="required"> - <annotation> - <documentation> - The name of the configuration type as it should appear in the configuration wizard. Examples are "CVS", "WebDAV". - </documentation> - </annotation> - </attribute> - <attribute name="icon" type="string" use="required"> - <annotation> - <documentation> - the icon to present in the configuration wizard next to the name. - </documentation> - <appInfo> - <meta.attribute kind="resource"/> - </appInfo> - </annotation> - </attribute> - <attribute name="class" type="string" use="required"> - <annotation> - <documentation> - a fully qualified name of the Java class implementing <samp>org.eclipse.team.ui.IConfigurationWizard</samp>. - </documentation> - <appInfo> - <meta.attribute kind="java" basedOn="org.eclipse.jface.wizard.Wizard:org.eclipse.team.ui.IConfigurationWizard"/> - </appInfo> - </annotation> - </attribute> - <attribute name="id" type="string" use="required"> - <annotation> - <documentation> - a unique identifier for this extension. - </documentation> - </annotation> - </attribute> - </complexType> - </element> - - <annotation> - <appInfo> - <meta.section type="examples"/> - </appInfo> - <documentation> - Following is an example of a configuration wizard extension: - -<p> -<pre> - <extension point="org.eclipse.team.ui.configurationWizard"> - <wizard - name="WebDAV" - icon="webdav.gif" - class="com.xyz.DAVDecorator" - id="com.xyz.dav"> - </wizard> - </extension> -</pre> -</p> - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="apiInfo"/> - </appInfo> - <documentation> - The value of the <samp>class</samp> attribute must represent a class that implements <samp>org.eclipse.team.ui.IConfigurationWizard</samp>. -This interface supports configuration of a wizard given a workbench and a project. - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="implementation"/> - </appInfo> - <documentation> - The plug-in org.eclipse.team.provider.examples.ui contains sample implementations of IConfigurationWizard for the WebDAV and filesystem provider types. - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="copyright"/> - </appInfo> - <documentation> - Copyright (c) 2002 IBM Corporation and others. -All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a> - </documentation> - </annotation> - -</schema> diff --git a/bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd b/bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd deleted file mode 100644 index c834e81d1..000000000 --- a/bundles/org.eclipse.team.ui/schema/synchronizeParticipants.exsd +++ /dev/null @@ -1,146 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.team.ui">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.team.ui" id="synchronizeParticipants" name="Synchronize View Participants"/>
- </appInfo>
- <documentation>
- This extension point is used to register a synchronize participant with the Synchronize View. A synchronize participant provides a logical connection between local resources and a remote location that is used to share those resources. The Synchronize View displays synchronize participants. -<p> -Providers may provide an extension for this extension point, and an implementation of <samp>org.eclipse.team.ui.synchronize.ISynchronizeParticipant</samp>. -</p>
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="participant"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- A fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- An optional identifier of the extension instance.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- An optional name for this extension instance.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="participant">
- <complexType>
- <attribute name="icon" type="string">
- <annotation>
- <documentation>
- An icon that will be used when showing this participant in lists and menus.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- A unique name that will be used to identify this type of participant.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string">
- <annotation>
- <documentation>
- A fully qualified name of the class the implements <samp>org.eclipse.team.ui.synchronize.ISynchronizeParticipant</samp>. A common practice is to subclass <samp>org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant</samp> in order to inherit some of the default functionality. In addition, it is recommended to subclass <samp>org.eclipse.team.ui.synchronize.TeamSubscriberParticipant</samp> to benefit from a full featured participant based on the <samp>org.eclipse.team.core.TeamSubscriber</samp> implementation.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="type" type="string">
- <annotation>
- <documentation>
- A value identifying the type of participant. Possible values are <samp>static</samp> if the participant is to be created automatically by the Team plugin or <samp>dynamic</samp> if the participant will be created and registered with the Synchronize Manager at some other time.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- The name of the participant. This will be shown in the UI.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- <extension -point="org.eclipse.team.ui.synchronizeParticipants"> -<participant -name="CVS Workspace" -icon="icons/full/cview16/server.gif" class="org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant" -type="static" -id="org.eclipse.team.cvs.ui.cvsworkspace-participant"> -</participant> -<participant -name="CVS Merge" -icon="icons/full/obj16/prjversions_rep.gif" -class="org.eclipse.team.internal.ccvs.ui.subscriber.MergeSynchronizeParticipant" -type="dynamic" -id="org.eclipse.team.cvs.ui.cvsmerge-participant"> -</participant> -</extension>
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- The value of the <samp>class</samp> attribute must represent a class that implements <samp>org.eclipse.team.ui.synchronize.ISynchronizeView</samp>.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2003 IBM Corporation and others. -All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java deleted file mode 100644 index 5ed5e1da6..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui; - -public interface IHelpContextIds { - public static final String PREFIX = TeamUIPlugin.ID + "."; //$NON-NLS-1$ - - // Preference Pages - public static final String TEAM_PREFERENCE_PAGE = PREFIX + "team_preference_page_context"; //$NON-NLS-1$ - public static final String IGNORE_PREFERENCE_PAGE = PREFIX + "ignore_preference_page_context"; //$NON-NLS-1$ - public static final String FILE_TYPE_PREFERENCE_PAGE = PREFIX + "file_type_preference_page_context"; //$NON-NLS-1$ - - // Wizard Pages - public static final String SHARE_PROJECT_PAGE = PREFIX + "share_project_page_context"; //$NON-NLS-1$ - public static final String IMPORT_PROJECT_SET_PAGE = PREFIX + "import_project_set_page_context"; //$NON-NLS-1$ - public static final String EXPORT_PROJECT_SET_PAGE = PREFIX + "export_project_set_page_context"; //$NON-NLS-1$ - public static final String TARGET_NEW_SITE_PAGE = PREFIX + "target_new_site_page_context"; //$NON-NLS-1$ - public static final String TARGET_MAPPING_SELECTION_PAGE = PREFIX + "target_mapping_selection_page_context"; //$NON-NLS-1$ - - // Catchup Release Viewers - public static final String TARGET_CATCHUP_RELEASE_VIEWER = PREFIX + "target_catchup_release_viewer_context"; //$NON-NLS-1$ - - // Target Actions - public static final String SYNC_GET_ACTION = PREFIX + "sync_get_action_context"; //$NON-NLS-1$ - public static final String SYNC_PUT_ACTION = PREFIX + "sync_put_action_context"; //$NON-NLS-1$ - - // Views - public static final String SITE_EXPLORER_VIEW = PREFIX + "site_explorer_view_context"; //$NON-NLS-1$ - public static final String SYNC_VIEW = PREFIX + "sync_view_context"; //$NON-NLS-1$ - - // Site Explorer View Actions - public static final String ADD_SITE_ACTION = PREFIX + "add_site_action_context"; //$NON-NLS-1$ - public static final String NEW_FOLDER_ACTION = PREFIX + "new_folder_action_context"; //$NON-NLS-1$ - - // Sync View Actions - public static final String OPEN_ACTION = PREFIX + "open_action_context"; //$NON-NLS-1$ - public static final String EXPANDALL_ACTION = PREFIX + "expandall_action_context"; //$NON-NLS-1$ - public static final String REMOVE_ACTION = PREFIX + "remove_action_context"; //$NON-NLS-1$ - public static final String NAVIGATOR_SHOW_ACTION = PREFIX + "navigator_show_action_context"; //$NON-NLS-1$ -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java deleted file mode 100644 index 3bd284dc8..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui; - -public interface IPreferenceIds { - public static final String PREFIX = TeamUIPlugin.ID + "."; //$NON-NLS-1$ - - // Sync Viewer - public static final String SYNCVIEW_COMPRESS_FOLDERS = PREFIX + "compress_folders"; //$NON-NLS-1$ - public static final String SYNCVIEW_SELECTED_MODE = PREFIX + "syncview_selected_mode"; //$NON-NLS-1$ - - public static final String SYNCVIEW_DEFAULT_PERSPECTIVE = PREFIX + "syncview_default_perspective"; //$NON-NLS-1$ - public static final String SYNCVIEW_DEFAULT_PERSPECTIVE_NONE = PREFIX + "sync_view_perspective_none"; //$NON-NLS-1$ - - public static final String SYNCVIEW_VIEW_SYNCINFO_IN_LABEL = PREFIX + "view_syncinfo_in_label"; //$NON-NLS-1$ - - public static final String SYNCVIEW_VIEW_PROMPT_WHEN_NO_CHANGES = PREFIX + "syncview_promptwhennochanges"; //$NON-NLS-1$ - public static final String SYNCVIEW_VIEW_PROMPT_WITH_CHANGES = PREFIX + "syncview_promptwithchanges"; //$NON-NLS-1$ - - public static final String SYNCVIEW_VIEW_BKG_PROMPT_WHEN_NO_CHANGES = PREFIX + "syncview__bkg_promptwhennochanges"; //$NON-NLS-1$ - public static final String SYNCVIEW_VIEW_BKG_PROMPT_WITH_CHANGES = PREFIX + "syncview_bkg_promptwithchanges"; //$NON-NLS-1$ - - public static final String SYNCHRONIZING_DEFAULT_PARTICIPANT = PREFIX + "sychronizing_default_participant"; //$NON-NLS-1$ - public static final String SYNCHRONIZING_COMPLETE_SHOW_DIALOG = PREFIX + "sychronizing_dontshow_complete_dialog"; //$NON-NLS-1$ - - public static final String SYNCHRONIZING_COMPLETE_PERSPECTIVE = PREFIX + "sychronizing_default_perspective_to_show"; //$NON-NLS-1$ - public static final String SYNCHRONIZING_COMPLETE_PERSPECTIVE_PROMPT = PREFIX + "sychronizing_default_perspective_to_show_prompt"; //$NON-NLS-1$ - public static final String SYNCHRONIZING_COMPLETE_PERSPECTIVE_ALWAYS = PREFIX + "sychronizing_default_perspective_to_show_always"; //$NON-NLS-1$ - public static final String SYNCHRONIZING_COMPLETE_PERSPECTIVE_NEVER = PREFIX + "sychronizing_default_perspective_to_show_never"; //$NON-NLS-1$ -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/OverlayIcon.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/OverlayIcon.java deleted file mode 100644 index df86de033..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/OverlayIcon.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui; - -import java.util.Arrays; - -import org.eclipse.jface.resource.CompositeImageDescriptor; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.graphics.*; - -/** - * An OverlayIcon consists of a main icon and several adornments. - */ -public class OverlayIcon extends CompositeImageDescriptor { - // the base image - private Image base; - // the overlay images - private ImageDescriptor[] overlays; - // the size - private Point size; - // the locations - private int[] locations; - - public static final int TOP_LEFT = 0; - public static final int TOP_RIGHT = 1; - public static final int BOTTOM_LEFT = 2; - public static final int BOTTOM_RIGHT = 3; - - /** - * OverlayIcon constructor. - * - * @param base the base image - * @param overlays the overlay images - * @param locations the location of each image - * @param size the size - */ - public OverlayIcon(Image base, ImageDescriptor[] overlays, int[] locations, Point size) { - this.base = base; - this.overlays = overlays; - this.locations = locations; - this.size = size; - } - - protected void drawOverlays(ImageDescriptor[] overlays, int[] locations) { - Point size = getSize(); - for (int i = 0; i < overlays.length; i++) { - ImageDescriptor overlay = overlays[i]; - ImageData overlayData = overlay.getImageData(); - switch (locations[i]) { - case TOP_LEFT: - drawImage(overlayData, 0, 0); - break; - case TOP_RIGHT: - drawImage(overlayData, size.x - overlayData.width, 0); - break; - case BOTTOM_LEFT: - drawImage(overlayData, 0, size.y - overlayData.height); - break; - case BOTTOM_RIGHT: - drawImage(overlayData, size.x - overlayData.width, size.y - overlayData.height); - break; - } - } - } - - public boolean equals(Object o) { - if (! (o instanceof OverlayIcon)) return false; - OverlayIcon other = (OverlayIcon) o; - return base.equals(other.base) && Arrays.equals(overlays, other.overlays); - } - - public int hashCode() { - int code = base.hashCode(); - for (int i = 0; i < overlays.length; i++) { - code ^= overlays[i].hashCode(); - } - return code; - } - - - protected void drawCompositeImage(int width, int height) { - drawImage(base.getImageData(), 0, 0); - drawOverlays(overlays, locations); - } - - protected Point getSize() { - return size; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java deleted file mode 100644 index 700e99613..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java +++ /dev/null @@ -1,196 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui; - - -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.eclipse.core.runtime.*; -import org.eclipse.team.internal.core.InfiniteSubProgressMonitor; -import org.eclipse.team.internal.core.NullSubProgressMonitor; - -/** - * Policy implements NLS convenience methods for the plugin and - * makes progress monitor policy decisions - */ -public class Policy { - // The resource bundle to get strings from - protected static ResourceBundle bundle = null; - - /** - * Creates a NLS catalog for the given locale. - * - * @param bundleName the name of the bundle - */ - public static void localize(String bundleName) { - bundle = ResourceBundle.getBundle(bundleName); - } - - /** - * Lookup the message with the given ID in this catalog and bind its - * substitution locations with the given string. - * - * @param id the id to look up - * @param binding the string to bind to the result - * @return the bound string - */ - public static String bind(String id, String binding) { - return bind(id, new String[] { binding }); - } - - /** - * Lookup the message with the given ID in this catalog and bind its - * substitution locations with the given strings. - * - * @param id the id to look up - * @param binding1 the first string to bind to the result - * @param binding2 the second string to bind to the result - * @return the bound string - */ - public static String bind(String id, String binding1, String binding2) { - return bind(id, new String[] { binding1, binding2 }); - } - - /** - * Lookup the message with the given ID in this catalog and bind its - * substitution locations with the given strings. - * - * @param id the id to look up - * @param binding1 the first string to bind to the result - * @param binding2 the second string to bind to the result - * @param binding3 the third string to bind to the result - * @return the bound string - */ - public static String bind(String id, String binding1, String binding2,String binding3) { - return bind(id, new String[] { binding1, binding2, binding3 }); - } - - /** - * Gets a string from the resource bundle. We don't want to crash because of a missing String. - * Returns the key if not found. - * - * @param key the id to look up - * @return the string with the given key - */ - public static String bind(String key, ResourceBundle b) { - try { - return b.getString(key); - } catch (MissingResourceException e) { - return key; - } catch (NullPointerException e) { - return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * Gets a string from the resource bundle. We don't want to crash because of a missing String. - * Returns the key if not found. - * - * @param key the id to look up - * @return the string with the given key - */ - public static String bind(String key) { - try { - return bundle.getString(key); - } catch (MissingResourceException e) { - return key; - } catch (NullPointerException e) { - return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * Gets a string from the resource bundle and binds it with the given arguments. If the key is - * not found, return the key. - * - * @param key the id to look up - * @param args the strings to bind to the result - * @return the bound string - */ - public static String bind(String key, Object[] args) { - try { - return MessageFormat.format(bind(key), args); - } catch (MissingResourceException e) { - return key; - } catch (NullPointerException e) { - return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * Checks if the progress monitor is canceled. - * - * @param monitor the onitor to check for cancellation - * @throws OperationCanceledException if the monitor is canceled - */ - public static void checkCanceled(IProgressMonitor monitor) { - if (monitor.isCanceled()) { - throw new OperationCanceledException(); - } - } - /** - * Returns a monitor for the given monitor - * - * @param monitor the monitor to return a monitor for - * @return a monitor for the given monitor - */ - public static IProgressMonitor monitorFor(IProgressMonitor monitor) { - if (monitor == null) { - return new NullProgressMonitor(); - } - return monitor; - } - - public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks) { - if (monitor == null) - return new NullProgressMonitor(); - if (monitor instanceof NullProgressMonitor) - return monitor; - return new SubProgressMonitor(monitor, ticks); - } - - public static IProgressMonitor subInfiniteMonitorFor(IProgressMonitor monitor, int ticks) { - if (monitor == null) - return new NullProgressMonitor(); - if (monitor instanceof NullProgressMonitor) - return monitor; - return new InfiniteSubProgressMonitor(monitor, ticks); - } - - public static IProgressMonitor subNullMonitorFor(IProgressMonitor monitor) { - if (monitor == null) - return new NullProgressMonitor(); - if (monitor instanceof NullProgressMonitor) - return monitor; - return new NullSubProgressMonitor(monitor); - } - - public static String toTruncatedPath(IPath path, int split) { - // Search backwards until split separators are found - int count = 0; - String stringPath = path.toString(); - int index = stringPath.length(); - while (count++ < split && index != -1) { - index = stringPath.lastIndexOf(IPath.SEPARATOR, index - 1); - } - if (index == -1) { - return stringPath; - } else { - return "..." + stringPath.substring(index); //$NON-NLS-1$ - } - } - - public static ResourceBundle getBundle() { - return bundle; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java deleted file mode 100644 index 1d58bdff1..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -public class ProjectSetContentHandler extends DefaultHandler { - boolean inPsf = false; - boolean inProvider = false; - boolean inProject = false; - Map map; - String id; - List references; - boolean isVersionOne = false; - - /** - * @see ContentHandler#startElement(String, String, String, Attributes) - */ - public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { - String elementName = getElementName(namespaceURI, localName, qName); - if (elementName.equals("psf")) { //$NON-NLS-1$ //$NON-NLS-2$ - map = new HashMap(); - inPsf = true; - String version = atts.getValue("version"); //$NON-NLS-1$ - isVersionOne = version.equals("1.0"); //$NON-NLS-1$ - return; - } - if (isVersionOne) return; - if (elementName.equals("provider")) { //$NON-NLS-1$ //$NON-NLS-2$ - if (!inPsf) throw new SAXException(Policy.bind("ProjectSetContentHandler.Element_provider_must_be_contained_in_element_psf_4")); //$NON-NLS-1$ - inProvider = true; - id = atts.getValue("id"); //$NON-NLS-1$ - references = new ArrayList(); - return; - } - if (elementName.equals("project")) { //$NON-NLS-1$ //$NON-NLS-2$ - if (!inProvider) throw new SAXException(Policy.bind("ProjectSetContentHandler.Element_project_must_be_contained_in_element_provider_7")); //$NON-NLS-1$ - inProject = true; - String reference = atts.getValue("reference"); //$NON-NLS-1$ - references.add(reference); - return; - } - } - - /** - * @see ContentHandler#endElement(String, String, String) - */ - public void endElement(String namespaceURI, String localName, String qName) throws SAXException { - String elementName = getElementName(namespaceURI, localName, qName); - if (elementName.equals("psf")) { //$NON-NLS-1$ //$NON-NLS-2$ - inPsf = false; - return; - } - if (isVersionOne) return; - if (elementName.equals("provider")) { //$NON-NLS-1$ //$NON-NLS-2$ - map.put(id, references); - references = null; - inProvider = false; - return; - } - if (elementName.equals("project")) { //$NON-NLS-1$ //$NON-NLS-2$ - inProject = false; - return; - } - } - - public Map getReferences() { - return map; - } - - public boolean isVersionOne() { - return isVersionOne; - } - - /* - * Couldn't figure out from the SAX API exactly when localName vs. qName is used. - * However, the XML for project sets doesn't use namespaces so either of the two names - * is fine. Therefore, use whichever one is provided. - */ - private String getElementName(String namespaceURI, String localName, String qName) { - if (localName != null && localName.length() > 0) { - return localName; - } else { - return qName; - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamAdapterFactory.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamAdapterFactory.java deleted file mode 100644 index 315c9dcc1..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamAdapterFactory.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui; - -import org.eclipse.compare.structuremergeviewer.DiffNode; -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.team.internal.ui.synchronize.DiffNodeWorkbenchAdapter; -import org.eclipse.ui.model.IWorkbenchAdapter; - - -public class TeamAdapterFactory implements IAdapterFactory { - - private DiffNodeWorkbenchAdapter diffNodeAdapter = new DiffNodeWorkbenchAdapter(); - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) - */ - public Object getAdapter(Object adaptableObject, Class adapterType) { - if(adaptableObject instanceof DiffNode && adapterType == IWorkbenchAdapter.class) { - return diffNodeAdapter; - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() - */ - public Class[] getAdapterList() { - // TODO Auto-generated method stub - return new Class[] {IWorkbenchAdapter.class}; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java deleted file mode 100644 index 533724f5e..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java +++ /dev/null @@ -1,383 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui; - - -import java.lang.reflect.InvocationTargetException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.*; - -import org.eclipse.compare.structuremergeviewer.DiffNode; -import org.eclipse.core.runtime.*; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; -import org.eclipse.team.internal.ui.synchronize.SynchronizeManager; -import org.eclipse.team.internal.ui.synchronize.TeamSynchronizingPerspective; -import org.eclipse.team.internal.ui.synchronize.actions.GlobalRefreshAction; -import org.eclipse.team.ui.ISharedImages; -import org.eclipse.team.ui.TeamUI; -import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant; -import org.eclipse.ui.*; -import org.eclipse.ui.plugin.AbstractUIPlugin; - -/** - * TeamUIPlugin is the plugin for generic, non-provider specific, - * team UI functionality in the workbench. - */ -public class TeamUIPlugin extends AbstractUIPlugin { - - private static TeamUIPlugin instance; - - // image paths - public static final String ICON_PATH = "icons/full/"; //$NON-NLS-1$ - - public static final String ID = "org.eclipse.team.ui"; //$NON-NLS-1$ - - // plugin id - public static final String PLUGIN_ID = "org.eclipse.team.ui"; //$NON-NLS-1$ - - private static List propertyChangeListeners = new ArrayList(5); - - private Hashtable imageDescriptors = new Hashtable(20); - - /** - * Creates a new TeamUIPlugin. - * - * @param descriptor the plugin descriptor - */ - public TeamUIPlugin(IPluginDescriptor descriptor) { - super(descriptor); - initializeImages(this); - initializePreferences(); - instance = this; - } - - /** - * Creates an extension. If the extension plugin has not - * been loaded a busy cursor will be activated during the duration of - * the load. - * - * @param element the config element defining the extension - * @param classAttribute the name of the attribute carrying the class - * @return the extension object - */ - public static Object createExtension(final IConfigurationElement element, final String classAttribute) throws CoreException { - // If plugin has been loaded create extension. - // Otherwise, show busy cursor then create extension. - IPluginDescriptor plugin = element.getDeclaringExtension().getDeclaringPluginDescriptor(); - if (plugin.isPluginActivated()) { - return element.createExecutableExtension(classAttribute); - } else { - final Object [] ret = new Object[1]; - final CoreException [] exc = new CoreException[1]; - BusyIndicator.showWhile(null, new Runnable() { - public void run() { - try { - ret[0] = element.createExecutableExtension(classAttribute); - } catch (CoreException e) { - exc[0] = e; - } - } - }); - if (exc[0] != null) - throw exc[0]; - else - return ret[0]; - } - } - - /** - * Convenience method to get the currently active workbench page. Note that - * the active page may not be the one that the usr perceives as active in - * some situations so this method of obtaining the activae page should only - * be used if no other method is available. - * - * @return the active workbench page - */ - public static IWorkbenchPage getActivePage() { - IWorkbenchWindow window = getPlugin().getWorkbench().getActiveWorkbenchWindow(); - if (window == null) return null; - return window.getActivePage(); - } - - /** - * Return the default instance of the receiver. This represents the runtime plugin. - * - * @return the singleton plugin instance - */ - public static TeamUIPlugin getPlugin() { - // If the instance has not been initialized, we will wait. - // This can occur if multiple threads try to load the plugin at the same - // time (see bug 33825: http://bugs.eclipse.org/bugs/show_bug.cgi?id=33825) - while (instance == null) { - try { - Thread.sleep(50); - } catch (InterruptedException e) { - // ignore and keep trying - } - } - return instance; - } - /** - * Initializes the preferences for this plugin if necessary. - */ - protected void initializePreferences() { - IPreferenceStore store = getPreferenceStore(); - store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_SYNCINFO_IN_LABEL, false); - store.setDefault(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS, true); - store.setDefault(IPreferenceIds.SYNCVIEW_SELECTED_MODE, SubscriberParticipant.BOTH_MODE); - store.setDefault(IPreferenceIds.SYNCVIEW_DEFAULT_PERSPECTIVE, TeamSynchronizingPerspective.ID); - store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_PROMPT_WHEN_NO_CHANGES, true); - store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_PROMPT_WITH_CHANGES, true); - store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_BKG_PROMPT_WHEN_NO_CHANGES, false); - store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_BKG_PROMPT_WITH_CHANGES, true); - store.setDefault(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT, GlobalRefreshAction.NO_DEFAULT_PARTICPANT); - store.setDefault(IPreferenceIds.SYNCHRONIZING_COMPLETE_SHOW_DIALOG, true); - store.setDefault(IPreferenceIds.SYNCHRONIZING_COMPLETE_PERSPECTIVE, IPreferenceIds.SYNCHRONIZING_COMPLETE_PERSPECTIVE_PROMPT); //$NON-NLS-1$ - } - - /** - * Convenience method for logging statuses to the plugin log - * - * @param status the status to log - */ - public static void log(IStatus status) { - getPlugin().getLog().log(status); - } - - /** - * Convenience method for logging a TeamException in such a way that the - * stacktrace is logged as well. - * @param e - */ - public static void log(CoreException e) { - IStatus status = e.getStatus(); - log (status.getSeverity(), status.getMessage(), e); - } - - /** - * Log the given exception along with the provided message and severity indicator - */ - public static void log(int severity, String message, Throwable e) { - log(new Status(severity, ID, 0, message, e)); - } - - /** - * @see Plugin#startup() - */ - public void startup() throws CoreException { - Policy.localize("org.eclipse.team.internal.ui.messages"); //$NON-NLS-1$ - initializePreferences(); - IAdapterFactory factory = new TeamAdapterFactory(); - Platform.getAdapterManager().registerAdapters(factory, DiffNode.class); - ((SynchronizeManager)TeamUI.getSynchronizeManager()).init(); - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.Plugin#shutdown() - */ - public void shutdown() throws CoreException { - super.shutdown(); - ((SynchronizeManager)TeamUI.getSynchronizeManager()).dispose(); - } - - /** - * Register for changes made to Team properties. - */ - public static void addPropertyChangeListener(IPropertyChangeListener listener) { - propertyChangeListeners.add(listener); - } - - /** - * Deregister as a Team property changes. - */ - public static void removePropertyChangeListener(IPropertyChangeListener listener) { - propertyChangeListeners.remove(listener); - } - - /** - * Broadcast a Team property change. - */ - public static void broadcastPropertyChange(PropertyChangeEvent event) { - for (Iterator it = propertyChangeListeners.iterator(); it.hasNext();) { - IPropertyChangeListener listener = (IPropertyChangeListener)it.next(); - listener.propertyChange(event); - } - } - - /** - * Creates an image and places it in the image registry. - * - * @param id the identifier for the image - * @param baseURL the base URL for the image - */ - protected static void createImageDescriptor(TeamUIPlugin plugin, String id, URL baseURL) { - // Delegate to the plugin instance to avoid concurrent class loading problems - plugin.privateCreateImageDescriptor(id, baseURL); - } - private void privateCreateImageDescriptor(String id, URL baseURL) { - URL url = null; - try { - url = new URL(baseURL, ICON_PATH + id); - } catch (MalformedURLException e) { - } - ImageDescriptor desc = ImageDescriptor.createFromURL(url); - imageDescriptors.put(id, desc); - } - - /** - * Returns the image descriptor for the given image ID. - * Returns null if there is no such image. - * - * @param id the identifier for the image to retrieve - * @return the image associated with the given ID - */ - public static ImageDescriptor getImageDescriptor(String id) { - // Delegate to the plugin instance to avoid concurrent class loading problems - return getPlugin().privateGetImageDescriptor(id); - } - private ImageDescriptor privateGetImageDescriptor(String id) { - if(! imageDescriptors.containsKey(id)) { - URL baseURL = TeamUIPlugin.getPlugin().getDescriptor().getInstallURL(); - createImageDescriptor(getPlugin(), id, baseURL); - } - return (ImageDescriptor)imageDescriptors.get(id); - } - - /** - * Convenience method to get an image descriptor for an extension - * - * @param extension the extension declaring the image - * @param subdirectoryAndFilename the path to the image - * @return the image - */ - public static ImageDescriptor getImageDescriptorFromExtension(IExtension extension, String subdirectoryAndFilename) { - IPluginDescriptor pluginDescriptor = extension.getDeclaringPluginDescriptor(); - URL path = pluginDescriptor.getInstallURL(); - URL fullPathString = null; - try { - fullPathString = new URL(path,subdirectoryAndFilename); - return ImageDescriptor.createFromURL(fullPathString); - } catch (MalformedURLException e) { - } - return null; - } - /* - * Initializes the table of images used in this plugin. The plugin is - * provided because this method is called before the plugin staic - * variable has been set. See the comment on the getPlugin() method - * for a description of why this is required. - */ - private void initializeImages(TeamUIPlugin plugin) { - URL baseURL = plugin.getDescriptor().getInstallURL(); - - // Overlays - createImageDescriptor(plugin, ISharedImages.IMG_DIRTY_OVR, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_CONFLICT_OVR, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_CHECKEDIN_OVR, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_CHECKEDOUT_OVR, baseURL); - - createImageDescriptor(plugin, ISharedImages.IMG_SYNC_VIEW, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_COMPARE_VIEW, baseURL); - - // Collapse all - createImageDescriptor(plugin, ISharedImages.IMG_COLLAPSE_ALL, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_COLLAPSE_ALL_ENABLED, baseURL); - - // Target Management Icons - createImageDescriptor(plugin, ISharedImages.IMG_SITE_ELEMENT, baseURL); - - // Sync View Icons - createImageDescriptor(plugin, ISharedImages.IMG_DLG_SYNC_INCOMING, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_DLG_SYNC_OUTGOING, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_DLG_SYNC_CONFLICTING, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_REFRESH, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_CHANGE_FILTER, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_IGNORE_WHITESPACE, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_CONTENTS, baseURL); - - createImageDescriptor(plugin, ISharedImages.IMG_DLG_SYNC_INCOMING_DISABLED, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_DLG_SYNC_OUTGOING_DISABLED, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_DLG_SYNC_CONFLICTING_DISABLED, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_REFRESH_DISABLED, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_IGNORE_WHITESPACE_DISABLED, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_CONTENTS_DISABLED, baseURL); - - createImageDescriptor(plugin, ISharedImages.IMG_DLG_SYNC_INCOMING_ENABLED, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_DLG_SYNC_OUTGOING_ENABLED, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_DLG_SYNC_CONFLICTING_ENABLED, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_REFRESH_ENABLED, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_IGNORE_WHITESPACE_ENABLED, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_CONTENTS_ENABLED, baseURL); - - createImageDescriptor(plugin, ISharedImages.IMG_SYNC_MODE_CATCHUP, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_SYNC_MODE_RELEASE, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_SYNC_MODE_FREE, baseURL); - - createImageDescriptor(plugin, ISharedImages.IMG_SYNC_MODE_CATCHUP_DISABLED, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_SYNC_MODE_RELEASE_DISABLED, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_SYNC_MODE_FREE_DISABLED, baseURL); - - createImageDescriptor(plugin, ISharedImages.IMG_SYNC_MODE_CATCHUP_ENABLED, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_SYNC_MODE_RELEASE_ENABLED, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_SYNC_MODE_FREE_ENABLED, baseURL); - - createImageDescriptor(plugin, ISharedImages.IMG_WIZBAN_SHARE, baseURL); - - // Wizard banners - createImageDescriptor(plugin, ISharedImages.IMG_PROJECTSET_IMPORT_BANNER, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_PROJECTSET_EXPORT_BANNER, baseURL); - - // Live Sync View icons - createImageDescriptor(plugin, ISharedImages.IMG_COMPRESSED_FOLDER, baseURL); - createImageDescriptor(plugin, ISharedImages.IMG_WARNING, baseURL); - } - - /** - * Returns the standard display to be used. The method first checks, if - * the thread calling this method has an associated display. If so, this - * display is returned. Otherwise the method returns the default display. - */ - public static Display getStandardDisplay() { - Display display= Display.getCurrent(); - if (display == null) { - display= Display.getDefault(); - } - return display; - } - - public Image getImage(String key) { - Image image = getImageRegistry().get(key); - if(image == null) { - ImageDescriptor d = getImageDescriptor(key); - image = d.createImage(); - getImageRegistry().put(key, image); - } - return image; - } - - public static void run(IRunnableWithProgress runnable) { - try { - PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(true, true, runnable); - } catch (InvocationTargetException e) { - Utils.handleError(getStandardDisplay().getActiveShell(), e, null, null); - } catch (InterruptedException e2) { - // Nothing to be done - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java deleted file mode 100644 index 1a942e1c2..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java +++ /dev/null @@ -1,506 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui; - -import java.io.*; -import java.lang.reflect.InvocationTargetException; -import java.util.*; -import java.util.List; - -import org.eclipse.compare.CompareConfiguration; -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.*; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.*; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.widgets.*; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.synchronize.SyncInfo; -import org.eclipse.team.core.variants.IResourceVariant; -import org.eclipse.team.ui.TeamImages; -import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant; -import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement; -import org.eclipse.ui.*; -import org.eclipse.ui.progress.IWorkbenchSiteProgressService; - -public class Utils { - - /** - * The SortOperation takes a collection of objects and returns a sorted - * collection of these objects. Concrete instances of this class provide - * the criteria for the sorting of the objects based on the type of the - * objects. - */ - static public abstract class Sorter { - - /** - * Returns true is elementTwo is 'greater than' elementOne This is the - * 'ordering' method of the sort operation. Each subclass overides this - * method with the particular implementation of the 'greater than' - * concept for the objects being sorted. - */ - public abstract boolean compare(Object elementOne, Object elementTwo); - - /** - * Sort the objects in sorted collection and return that collection. - */ - private Object[] quickSort(Object[] sortedCollection, int left, int right) { - int originalLeft = left; - int originalRight = right; - Object mid = sortedCollection[(left + right) / 2]; - do { - while (compare(sortedCollection[left], mid)) - left++; - while (compare(mid, sortedCollection[right])) - right--; - if (left <= right) { - Object tmp = sortedCollection[left]; - sortedCollection[left] = sortedCollection[right]; - sortedCollection[right] = tmp; - left++; - right--; - } - } while (left <= right); - if (originalLeft < right) - sortedCollection = quickSort(sortedCollection, originalLeft, right); - if (left < originalRight) - sortedCollection = quickSort(sortedCollection, left, originalRight); - return sortedCollection; - } - - /** - * Return a new sorted collection from this unsorted collection. Sort - * using quick sort. - */ - public Object[] sort(Object[] unSortedCollection) { - int size = unSortedCollection.length; - Object[] sortedCollection = new Object[size]; - //copy the array so can return a new sorted collection - System.arraycopy(unSortedCollection, 0, sortedCollection, 0, size); - if (size > 1) - quickSort(sortedCollection, 0, size - 1); - return sortedCollection; - } - } - - /** - * Shows the given errors to the user. - * @param Exception - * the exception containing the error - * @param title - * the title of the error dialog - * @param message - * the message for the error dialog - * @param shell - * the shell to open the error dialog in - */ - public static void handleError(Shell shell, Exception exception, String title, String message) { - IStatus status = null; - boolean log = false; - boolean dialog = false; - Throwable t = exception; - if (exception instanceof TeamException) { - status = ((TeamException) exception).getStatus(); - log = false; - dialog = true; - } else if (exception instanceof InvocationTargetException) { - t = ((InvocationTargetException) exception).getTargetException(); - if (t instanceof TeamException) { - status = ((TeamException) t).getStatus(); - log = false; - dialog = true; - } else if (t instanceof CoreException) { - status = ((CoreException) t).getStatus(); - log = true; - dialog = true; - } else if (t instanceof InterruptedException) { - return; - } else { - status = new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("TeamAction.internal"), t); //$NON-NLS-1$ - log = true; - dialog = true; - } - } - if (status == null) - return; - if (!status.isOK()) { - IStatus toShow = status; - if (status.isMultiStatus()) { - IStatus[] children = status.getChildren(); - if (children.length == 1) { - toShow = children[0]; - } - } - if (title == null) { - title = status.getMessage(); - } - if (message == null) { - message = status.getMessage(); - } - if (dialog && shell != null) { - ErrorDialog.openError(shell, title, message, toShow); - } - if (log || shell == null) { - TeamUIPlugin.log(toShow.getSeverity(), message, t); - } - } - } - - public static void runWithProgress(Shell parent, boolean cancelable, final IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException { - boolean createdShell = false; - try { - if (parent == null || parent.isDisposed()) { - Display display = Display.getCurrent(); - if (display == null) { - // cannot provide progress (not in UI thread) - runnable.run(new NullProgressMonitor()); - return; - } - // get the active shell or a suitable top-level shell - parent = display.getActiveShell(); - if (parent == null) { - parent = new Shell(display); - createdShell = true; - } - } - // pop up progress dialog after a short delay - final Exception[] holder = new Exception[1]; - BusyIndicator.showWhile(parent.getDisplay(), new Runnable() { - - public void run() { - try { - runnable.run(new NullProgressMonitor()); - } catch (InvocationTargetException e) { - holder[0] = e; - } catch (InterruptedException e) { - holder[0] = e; - } - } - }); - if (holder[0] != null) { - if (holder[0] instanceof InvocationTargetException) { - throw (InvocationTargetException) holder[0]; - } else { - throw (InterruptedException) holder[0]; - } - } - //new TimeoutProgressMonitorDialog(parent, TIMEOUT).run(true - // /*fork*/, cancelable, runnable); - } finally { - if (createdShell) - parent.dispose(); - } - } - - /** - * Creates a progress monitor and runs the specified runnable. - * @param parent - * the parent Shell for the dialog - * @param cancelable - * if true, the dialog will support cancelation - * @param runnable - * the runnable - * @exception InvocationTargetException - * when an exception is thrown from the runnable - * @exception InterruptedException - * when the progress monitor is cancelled - */ - public static void runWithProgressDialog(Shell parent, boolean cancelable, final IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException { - new ProgressMonitorDialog(parent).run(cancelable, cancelable, runnable); - } - - public static Shell getShell(IWorkbenchSite site) { - if(site != null) { - Shell shell = site.getShell(); - if (!shell.isDisposed()) - return shell; - } - IWorkbench workbench = TeamUIPlugin.getPlugin().getWorkbench(); - if (workbench != null) { - IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); - if (window != null) { - return window.getShell(); - } - } - // Fallback to using the display - Display display = Display.getDefault(); - if (display.isDisposed()) return null; - return new Shell(display); - } - /* - * This method is only for use by the Target Management feature (see bug - * 16509). @param t - */ - public static void handle(Throwable t) { - IStatus error = null; - if (t instanceof InvocationTargetException) { - t = ((InvocationTargetException) t).getTargetException(); - } - if (t instanceof CoreException) { - error = ((CoreException) t).getStatus(); - } else if (t instanceof TeamException) { - error = ((TeamException) t).getStatus(); - } else { - error = new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("simpleInternal"), t); //$NON-NLS-1$ - } - Shell shell = new Shell(Display.getDefault()); - if (error.getSeverity() == IStatus.INFO) { - MessageDialog.openInformation(shell, Policy.bind("information"), error.getMessage()); //$NON-NLS-1$ - } else { - ErrorDialog.openError(shell, Policy.bind("exception"), null, error); //$NON-NLS-1$ - } - shell.dispose(); - // Let's log non-team exceptions - if (!(t instanceof TeamException)) { - TeamUIPlugin.log(error.getSeverity(), error.getMessage(), t); - } - } - - public static IWorkbenchPartSite findSite(Control c) { - while (c != null && !c.isDisposed()) { - Object data = c.getData(); - if (data instanceof IWorkbenchPart) - return ((IWorkbenchPart) data).getSite(); - c = c.getParent(); - } - return null; - } - - public static IWorkbenchPartSite findSite() { - IWorkbench workbench = TeamUIPlugin.getPlugin().getWorkbench(); - IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); - if (window != null) { - IWorkbenchPage page = window.getActivePage(); - if (page != null) { - IWorkbenchPart part = page.getActivePart(); - if (part != null) - return part.getSite(); - } - } - return null; - } - - public static void initAction(IAction a, String prefix) { - Utils.initAction(a, prefix, Policy.bundle); - } - - public static void updateLabels(SyncInfo sync, CompareConfiguration config) { - final IResourceVariant remote = sync.getRemote(); - final IResourceVariant base = sync.getBase(); - String localContentId = sync.getLocalContentIdentifier(); - if (localContentId != null) { - config.setLeftLabel(Policy.bind("SyncInfoCompareInput.localLabelExists", localContentId)); //$NON-NLS-1$ - } else { - config.setLeftLabel(Policy.bind("SyncInfoCompareInput.localLabel")); //$NON-NLS-1$ - } - if (remote != null) { - config.setRightLabel(Policy.bind("SyncInfoCompareInput.remoteLabelExists", remote.getContentIdentifier())); //$NON-NLS-1$ - } else { - config.setRightLabel(Policy.bind("SyncInfoCompareInput.remoteLabel")); //$NON-NLS-1$ - } - if (base != null) { - config.setAncestorLabel(Policy.bind("SyncInfoCompareInput.baseLabelExists", base.getContentIdentifier())); //$NON-NLS-1$ - } else { - config.setAncestorLabel(Policy.bind("SyncInfoCompareInput.baseLabel")); //$NON-NLS-1$ - } - } - - /** - * Initialize the given Action from a ResourceBundle. - */ - public static void initAction(IAction a, String prefix, ResourceBundle bundle) { - String labelKey = "label"; //$NON-NLS-1$ - String tooltipKey = "tooltip"; //$NON-NLS-1$ - String imageKey = "image"; //$NON-NLS-1$ - String descriptionKey = "description"; //$NON-NLS-1$ - if (prefix != null && prefix.length() > 0) { - labelKey = prefix + labelKey; - tooltipKey = prefix + tooltipKey; - imageKey = prefix + imageKey; - descriptionKey = prefix + descriptionKey; - } - String s = Policy.bind(labelKey, bundle); - if (s != null) - a.setText(s); - s = Policy.bind(tooltipKey, bundle); - if (s != null) - a.setToolTipText(s); - s = Policy.bind(descriptionKey, bundle); - if (s != null) - a.setDescription(s); - String relPath = Policy.bind(imageKey, bundle); - if (relPath != null && !relPath.equals(imageKey) && relPath.trim().length() > 0) { - String cPath; - String dPath; - String ePath; - if (relPath.indexOf("/") >= 0) { //$NON-NLS-1$ - String path = relPath.substring(1); - cPath = 'c' + path; - dPath = 'd' + path; - ePath = 'e' + path; - } else { - cPath = "clcl16/" + relPath; //$NON-NLS-1$ - dPath = "dlcl16/" + relPath; //$NON-NLS-1$ - ePath = "elcl16/" + relPath; //$NON-NLS-1$ - } - ImageDescriptor id = TeamImages.getImageDescriptor(dPath); // we - // set - // the - // disabled - // image - // first - // (see - // PR - // 1GDDE87) - if (id != null) - a.setDisabledImageDescriptor(id); - id = TeamUIPlugin.getImageDescriptor(cPath); - if (id != null) - a.setHoverImageDescriptor(id); - id = TeamUIPlugin.getImageDescriptor(ePath); - if (id != null) - a.setImageDescriptor(id); - } - } - - public static String modeToString(int mode) { - switch (mode) { - case SubscriberParticipant.INCOMING_MODE : - return Policy.bind("Utils.22"); //$NON-NLS-1$ - case SubscriberParticipant.OUTGOING_MODE : - return Policy.bind("Utils.23"); //$NON-NLS-1$ - case SubscriberParticipant.BOTH_MODE : - return Policy.bind("Utils.24"); //$NON-NLS-1$ - case SubscriberParticipant.CONFLICTING_MODE : - return Policy.bind("Utils.25"); //$NON-NLS-1$ - } - return Policy.bind("Utils.26"); //$NON-NLS-1$ - } - - public static String workingSetToString(IWorkingSet set, int maxLength) { - String text = Policy.bind("StatisticsPanel.noWorkingSet"); //$NON-NLS-1$ - if (set != null) { - text = set.getName(); - if (text.length() > maxLength) { - text = text.substring(0, maxLength - 3) + "..."; //$NON-NLS-1$ - } - } - return text; - } - - /** - * Returns the list of resources contained in the given elements. - * @param elements - * @return the list of resources contained in the given elements. - */ - public static IResource[] getResources(Object[] elements) { - List resources = new ArrayList(); - for (int i = 0; i < elements.length; i++) { - Object element = elements[i]; - IResource resource = null; - if (element instanceof IResource) { - resource = (IResource)element; - } else if (element instanceof SynchronizeModelElement){ - resource = ((SynchronizeModelElement) element).getResource(); - } else { - resource = (IResource)getAdapter(element, IResource.class); - } - if (resource != null) { - resources.add(resource); - } - } - return (IResource[]) resources.toArray(new IResource[resources.size()]); - } - - public static Object getAdapter(Object element, Class adapter) { - if (element instanceof IAdaptable) { - return ((IAdaptable) element).getAdapter(adapter); - } - return null; - } - - /** - * This method returns all out-of-sync SyncInfos that are in the current - * selection. - * - * @return the list of selected sync infos - */ - public static IDiffElement[] getDiffNodes(Object[] selected) { - Set result = new HashSet(); - for (int i = 0; i < selected.length; i++) { - Object object = selected[i]; - if(object instanceof IDiffElement) { - collectAllNodes((IDiffElement)object, result); - } - } - return (IDiffElement[]) result.toArray(new IDiffElement[result.size()]); - } - - private static void collectAllNodes(IDiffElement element, Set nodes) { - if(element.getKind() != SyncInfo.IN_SYNC) { - nodes.add(element); - } - if(element instanceof IDiffContainer) { - IDiffElement[] children = ((IDiffContainer)element).getChildren(); - for (int i = 0; i < children.length; i++) { - collectAllNodes(children[i], nodes); - } - } - } - - public static void schedule(Job job, IWorkbenchSite site) { - if (site != null) { - IWorkbenchSiteProgressService siteProgress = (IWorkbenchSiteProgressService) site.getAdapter(IWorkbenchSiteProgressService.class); - if (siteProgress != null) { - siteProgress.useHalfBusyCursor(job); - siteProgress.schedule(job); - return; - } - } - job.schedule(); - } - - public static byte[] readBytes(InputStream in) { - ByteArrayOutputStream bos= new ByteArrayOutputStream(); - try { - while (true) { - int c= in.read(); - if (c == -1) - break; - bos.write(c); - } - - } catch (IOException ex) { - return null; - - } finally { - if (in != null) { - try { - in.close(); - } catch (IOException x) { - // silently ignored - } - } - try { - bos.close(); - } catch (IOException x) { - // silently ignored - } - } - - return bos.toByteArray(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java deleted file mode 100644 index 2ec58ed3b..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.actions; - - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.wizards.ConfigureProjectWizard; - -/** - * Action for configuring a project. Configuring involves associating - * the project with a Team provider and performing any provider-specific - * configuration that is necessary. - */ -public class ConfigureProjectAction extends TeamAction { - private static class ResizeWizardDialog extends WizardDialog { - public ResizeWizardDialog(Shell parentShell, IWizard newWizard) { - super(parentShell, newWizard); - setShellStyle(getShellStyle() | SWT.RESIZE); - } - } - - /* - * Method declared on IActionDelegate. - */ - public void run(IAction action) { - run(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - IProject project = getSelectedProjects()[0]; - ConfigureProjectWizard wizard = new ConfigureProjectWizard(); - wizard.init(null, project); - WizardDialog dialog = new ResizeWizardDialog(getShell(), wizard); - //dialog. - dialog.open(); - } catch (Exception e) { - throw new InvocationTargetException(e); - } - } - }, Policy.bind("ConfigureProjectAction.configureProject"), PROGRESS_BUSYCURSOR); //$NON-NLS-1$ - } - /** - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() { - IProject[] selectedProjects = getSelectedProjects(); - if (selectedProjects.length != 1) return false; - if (!selectedProjects[0].isAccessible()) return false; - if (!RepositoryProvider.isShared(selectedProjects[0])) return true; - return false; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/DeconfigureProjectAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/DeconfigureProjectAction.java deleted file mode 100644 index d30b66b22..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/DeconfigureProjectAction.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.actions; - - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -/** - * Action for deconfiguring a project. Deconfiguring involves removing - * associated provider for the project. - */ -public class DeconfigureProjectAction extends TeamAction { - /* - * Method declared on IActionDelegate. - */ - public void run(IAction action) { - run(new WorkspaceModifyOperation() { - public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { - try { - // should we use the id for the provider type and remove from the nature. Or would - // this operation be provider specific? - } catch (Exception e) { - throw new InvocationTargetException(e); - } - } - }, Policy.bind("DeconfigureProjectAction.deconfigureProject"), PROGRESS_BUSYCURSOR); //$NON-NLS-1$ - } - /** - * @see TeamAction#isEnabled() - */ - protected boolean isEnabled() { - IProject[] selectedProjects = getSelectedProjects(); - if (selectedProjects.length != 1) return false; - if (RepositoryProvider.getProvider(selectedProjects[0]) != null) return false; - return true; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ITeamRunnableContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ITeamRunnableContext.java deleted file mode 100644 index 184b68241..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ITeamRunnableContext.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.actions; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.swt.widgets.Shell; - -/** - * An ITeamRunnableContext is used to provide the context for a Team operation. - * The hierarchy of contexts is used to configure the following: - * 1) whether the operation is run in the background as a job - * 2) whether the operation modifies the workspace - * 3) what shell the operation should use to display info to the user - */ -public interface ITeamRunnableContext { - - /** - * Run the given runnable in the context of the receiver. By default, the - * progress is provided by the active workbench windows but subclasses may - * override this to provide progress in some other way (Progress Monitor or - * job). - */ - public abstract void run(IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException; - - /** - * Get a shell that can be used to prompt the user. - * @return a shell - */ - public abstract Shell getShell(); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/JobRunnableContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/JobRunnableContext.java deleted file mode 100644 index 2ee0a9034..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/JobRunnableContext.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.actions; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.WorkspaceJob; -import org.eclipse.core.runtime.*; -import org.eclipse.core.runtime.jobs.*; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.ui.IWorkbenchSite; - -/** - * This runnable context executes it's operation in the context of a background job. - */ -public final class JobRunnableContext implements ITeamRunnableContext { - - private IJobChangeListener listener; - private IWorkbenchSite site; - private String jobName; - private ISchedulingRule schedulingRule; - private boolean postponeBuild; - - public JobRunnableContext(String jobName) { - this(jobName, null, null); - } - - public JobRunnableContext(String jobName, IJobChangeListener listener, IWorkbenchSite site) { - this.jobName = jobName; - this.listener = listener; - this.site = site; - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ccvs.ui.operations.ITeamRunnableContext#run(java.lang.String, boolean, org.eclipse.jface.operation.IRunnableWithProgress) - */ - public void run(IRunnableWithProgress runnable) { - Job job; - if (schedulingRule == null && !postponeBuild) { - job = getBasicJob(runnable); - } else { - job = getWorkspaceJob(runnable); - if (schedulingRule != null) { - job.setRule(schedulingRule); - } - } - if (listener != null) { - job.addJobChangeListener(listener); - } - Utils.schedule(job, site); - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ccvs.ui.operations.ITeamRunnableContext#getShell() - */ - public Shell getShell() { - final Shell[] newShell = new Shell[] { null }; - Display.getDefault().syncExec( - new Runnable() { - public void run() { - newShell[0] = Utils.getShell(site); - } - }); - return newShell[0]; - } - - /** - * Returns whether the auto-build will be postponed while this - * context is executing a runnable. - * @return whether the auto-build will be postponed while this - * context is executing a runnable. - */ - public boolean isPostponeBuild() { - return postponeBuild; - } - - /** - * Set whether the auto-build will be postponed while this - * context is executing a runnable. - * @param postponeBuild whether to postpone the auto-build. - */ - public void setPostponeBuild(boolean postponeBuild) { - this.postponeBuild = postponeBuild; - } - - /** - * Return the scheduling rule that will be obtained before the context - * executes a runnable or <code>null</code> if no scheduling rule is to be onbtained. - * @return the schedulingRule to be obtained or <code>null</code>. - */ - public ISchedulingRule getSchedulingRule() { - return schedulingRule; - } - - /** - * Set the scheduling rule that will be obtained before the context - * executes a runnable or <code>null</code> if no scheduling rule is to be onbtained. - * @param schedulingRule The schedulingRule to be obtained or <code>null</code>. - */ - public void setSchedulingRule(ISchedulingRule schedulingRule) { - this.schedulingRule = schedulingRule; - } - - /* private */ IStatus run(IRunnableWithProgress runnable, IProgressMonitor monitor) { - try { - runnable.run(monitor); - } catch (InvocationTargetException e) { - return TeamException.asTeamException(e).getStatus(); - } catch (InterruptedException e) { - return Status.OK_STATUS; - } - return Status.OK_STATUS; - } - - private Job getBasicJob(final IRunnableWithProgress runnable) { - return new Job(jobName) { - public IStatus run(IProgressMonitor monitor) { - return JobRunnableContext.this.run(runnable, monitor); - } - }; - } - - private Job getWorkspaceJob(final IRunnableWithProgress runnable) { - return new WorkspaceJob(jobName) { - public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { - return JobRunnableContext.this.run(runnable, monitor); - } - }; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ProgressDialogRunnableContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ProgressDialogRunnableContext.java deleted file mode 100644 index 0896533b1..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ProgressDialogRunnableContext.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.actions; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.jface.operation.IRunnableContext; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.progress.IProgressService; - -/** - * This CVS runnable context blocks the UI and can therfore have a shell assigned to - * it (since the shell won't be closed by the user before the runnable completes. - */ -public class ProgressDialogRunnableContext implements ITeamRunnableContext { - - private Shell shell; - private IRunnableContext runnableContext; - private ISchedulingRule schedulingRule; - private boolean postponeBuild; - - public ProgressDialogRunnableContext(Shell shell) { - this.shell = shell; - } - - /** - * Returns whether the auto-build will be postponed while this - * context is executing a runnable. - * @return whether the auto-build will be postponed while this - * context is executing a runnable. - */ - public boolean isPostponeBuild() { - return postponeBuild; - } - - /** - * Set whether the auto-build will be postponed while this - * context is executing a runnable. - * @param postponeBuild whether to postpone the auto-build. - */ - public void setPostponeBuild(boolean postponeBuild) { - this.postponeBuild = postponeBuild; - } - - /** - * Return the scheduling rule that will be obtained before the context - * executes a runnable or <code>null</code> if no scheduling rule is to be onbtained. - * @return the schedulingRule to be obtained or <code>null</code>. - */ - public ISchedulingRule getSchedulingRule() { - return schedulingRule; - } - - /** - * Set the scheduling rule that will be obtained before the context - * executes a runnable or <code>null</code> if no scheduling rule is to be onbtained. - * @param schedulingRule The schedulingRule to be obtained or <code>null</code>. - */ - public void setSchedulingRule(ISchedulingRule schedulingRule) { - this.schedulingRule = schedulingRule; - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ccvs.ui.operations.CVSRunnableContext#getShell() - */ - public Shell getShell() { - return shell; - } - - /** - * Set the runnable context that is used to execute the runnable. By default, - * the workbench's progress service is used by clients can provide their own. - * @param runnableContext the runnable contentx used to execute runnables. - */ - public void setRunnableContext(IRunnableContext runnableContext) { - this.runnableContext = runnableContext; - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.actions.ITeamRunnableContext#run(org.eclipse.jface.operation.IRunnableWithProgress) - */ - public void run(IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException { - getRunnableContext().run(true /* fork */, true /* cancelable */, wrapRunnable(runnable)); - } - - private IRunnableContext getRunnableContext() { - if (runnableContext == null) { - return new IRunnableContext() { - public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) - throws InvocationTargetException, InterruptedException { - IProgressService manager = PlatformUI.getWorkbench().getProgressService(); - manager.busyCursorWhile(runnable); - } - }; - } - return runnableContext; - } - - /* - * Return an IRunnableWithProgress that sets the task name for the progress monitor - * and runs in a workspace modify operation if requested. - */ - private IRunnableWithProgress wrapRunnable(final IRunnableWithProgress runnable) { - return new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - if (schedulingRule == null && !postponeBuild) { - runnable.run(monitor); - } else { - final Exception[] exception = new Exception[] { null }; - ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { - public void run(IProgressMonitor pm) throws CoreException { - try { - runnable.run(pm); - } catch (InvocationTargetException e) { - exception[0] = e; - } catch (InterruptedException e) { - exception[0] = e; - } - } - }, schedulingRule, 0 /* allow updates */, monitor); - if (exception[0] != null) { - if (exception[0] instanceof InvocationTargetException) { - throw (InvocationTargetException)exception[0]; - } else if (exception[0] instanceof InterruptedException) { - throw (InterruptedException)exception[0]; - } - } - } - } catch (CoreException e) { - throw new InvocationTargetException(e); - } - } - }; - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/SubscriberAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/SubscriberAction.java deleted file mode 100644 index 58e456b03..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/SubscriberAction.java +++ /dev/null @@ -1,183 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.actions; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.team.core.synchronize.*; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.team.ui.synchronize.viewers.SyncInfoModelElement; -import org.eclipse.ui.*; - -/** - * This action provides utilities for performing operations on selections that - * are obtained from a view populated by a - * {@link org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider}. - * Subclasses can use this support to filter the selection in order to - * determine action enablement and generate the input to a {@link SubscriberOperation}. - * @see SyncInfo - * @see SyncInfoSet - * @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider - * @see org.eclipse.team.internal.ui.actions.SubscriberOperation - * @since 3.0 - */ -public abstract class SubscriberAction implements IObjectActionDelegate, IViewActionDelegate, IEditorActionDelegate { - - private IStructuredSelection selection; - private IWorkbenchPart part; - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public final void run(IAction action) { - // TODO: We used to prompt for unsaved changes in any editor. We don't anymore. Would - // it be better to prompt for unsaved changes to editors affected by this action? - try { - getSubscriberOperation(part, getFilteredDiffElements()).run(); - } catch (InvocationTargetException e) { - handle(e); - } catch (InterruptedException e) { - handle(e); - } - } - - /** - * Return the subscriber operation associated with this action. This operation - * will be run when the action is run. Subclass may implement this method and provide - * an operation subclass or may override the <code>run(IAction)</code> method directly - * if they choose not to implement a <code>SubscriberOperation</code>. - * @param elements the selected diff element for which this action is enabled. - * @return the subscriber operation to be run by this action. - */ - protected abstract SubscriberOperation getSubscriberOperation(IWorkbenchPart part, IDiffElement[] elements); - - /** - * Generic error handling code that uses an error dialog to show the error to the - * user. Subclasses can use this method and/or override it. - * @param e the exception that occurred. - */ - protected void handle(Exception e) { - Utils.handle(e); - } - - /** - * This method returns all instances of IDiffElement that are in the current - * selection. - * - * @return the selected elements - */ - protected final IDiffElement[] getSelectedDiffElements() { - return Utils.getDiffNodes(selection.toArray()); - } - - /** - * The default enablement behavior for subscriber actions is to enable - * the action if there is at least one SyncInfo in the selection - * for which the action's filter passes. - * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled() - */ - protected boolean isEnabled() { - return (getFilteredDiffElements().length > 0); - } - - /** - * Filter uses to filter the user selection to contain only those - * elements for which this action is enabled. - * Default filter includes all out-of-sync elements in the current - * selection. Subsclasses may override. - * @return a sync info filter which selects all out-of-sync resources. - */ - protected FastSyncInfoFilter getSyncInfoFilter() { - return new FastSyncInfoFilter(); - } - - /** - * Return the selected diff element for which this action is enabled. - * @return the list of selected diff elements for which this action is enabled. - */ - protected final IDiffElement[] getFilteredDiffElements() { - IDiffElement[] elements = getSelectedDiffElements(); - List filtered = new ArrayList(); - for (int i = 0; i < elements.length; i++) { - IDiffElement e = elements[i]; - if (e instanceof SyncInfoModelElement) { - SyncInfo info = ((SyncInfoModelElement) e).getSyncInfo(); - if (info != null && getSyncInfoFilter().select(info)) { - filtered.add(e); - } - } - } - return (IDiffElement[]) filtered.toArray(new IDiffElement[filtered.size()]); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart) - */ - public void setActivePart(IAction action, IWorkbenchPart targetPart) { - this.part = targetPart; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) - */ - public void init(IViewPart view) { - this.part = view; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged(IAction action, ISelection selection) { - if (selection instanceof IStructuredSelection) { - this.selection = (IStructuredSelection) selection; - if (action != null) { - setActionEnablement(action); - } - } - } - - /** - * Method invoked from <code>selectionChanged(IAction, ISelection)</code> - * to set the enablement status of the action. The instance variable - * <code>selection</code> will contain the latest selection so the methods - * <code>getSelectedResources()</code> and <code>getSelectedProjects()</code> - * will provide the proper objects. - * - * This method can be overridden by subclasses but should not be invoked by them. - */ - protected void setActionEnablement(IAction action) { - action.setEnabled(isEnabled()); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart) - */ - public void setActiveEditor(IAction action, IEditorPart targetEditor) { - // Ignore since these actions aren't meant for editors. - // This seems to be required because of a bug in the UI - // plug-in that will disable viewer actions if they aren't - // editor actions? Go figure... - } - - /** - * Returns the workbench part assigned to this action or <code>null</code>. - * @return Returns the part. - */ - public IWorkbenchPart getPart() { - return part; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/SubscriberOperation.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/SubscriberOperation.java deleted file mode 100644 index 38777a7bb..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/SubscriberOperation.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.actions; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.runtime.jobs.IJobChangeEvent; -import org.eclipse.team.core.synchronize.SyncInfo; -import org.eclipse.team.core.synchronize.SyncInfoSet; -import org.eclipse.team.ui.synchronize.viewers.SyncInfoModelElement; -import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement; -import org.eclipse.ui.IWorkbenchPart; - - -/** - * A subscriber operation provides access to a SyncInfoSet generated - * from the selection of the elements generated by a - * {@link org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider}. - * In addition, the elements in the view will show busy indication if this - * operation is run as a job. - * - * @see SyncInfoSet - */ -public abstract class SubscriberOperation extends TeamOperation { - - private IDiffElement[] elements; - - /** - * Create a subscriber operation that will operate on the given diff elements - * that were obtained from a view populated by a - * {@link org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider}. - * @param elements - */ - protected SubscriberOperation(IWorkbenchPart part, IDiffElement[] elements) { - super(part); - this.elements = elements; - } - - /** - * Returns a sync info set that contains the {@link SyncInfo} for the - * elements of this operations. - */ - protected SyncInfoSet getSyncInfoSet() { - return makeSyncInfoSetFromSelection(getSyncInfos()); - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.jobs.JobChangeAdapter#scheduled(org.eclipse.core.runtime.jobs.IJobChangeEvent) - */ - public void scheduled(IJobChangeEvent event) { - super.scheduled(event); - markBusy(elements, true); - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.jobs.JobChangeAdapter#done(org.eclipse.core.runtime.jobs.IJobChangeEvent) - */ - public void done(IJobChangeEvent event) { - markBusy(elements, false); - super.done(event); - } - - private void markBusy(IDiffElement[] elements, boolean isBusy) { - for (int i = 0; i < elements.length; i++) { - IDiffElement element = elements[i]; - if (element instanceof SynchronizeModelElement) { - ((SynchronizeModelElement)element).setPropertyToRoot(SynchronizeModelElement.BUSY_PROPERTY, isBusy); - } - } - } - - /* - * Return the selected SyncInfo for which this action is enabled. - * @return the selected SyncInfo for which this action is enabled. - */ - private SyncInfo[] getSyncInfos() { - List filtered = new ArrayList(); - for (int i = 0; i < elements.length; i++) { - IDiffElement e = elements[i]; - if (e instanceof SyncInfoModelElement) { - filtered.add(((SyncInfoModelElement)e).getSyncInfo()); - } - } - return (SyncInfo[]) filtered.toArray(new SyncInfo[filtered.size()]); - } - - /* - * Return a sync info set that contains the given sync info - */ - private SyncInfoSet makeSyncInfoSetFromSelection(SyncInfo[] infos) { - return new SyncInfoSet(infos); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java deleted file mode 100644 index 706fe6d96..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java +++ /dev/null @@ -1,362 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.actions; - - -import java.lang.reflect.Array; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceStatus; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.core.TeamPlugin; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.ui.IObjectActionDelegate; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.actions.ActionDelegate; - -/** - * The abstract superclass of all Team actions. This class contains some convenience - * methods for getting selected objects and mapping selected objects to their - * providers. - * - * Team providers may subclass this class when creating their actions. - * Team providers may also instantiate or subclass any of the - * subclasses of TeamAction provided in this package. - */ -public abstract class TeamAction extends ActionDelegate implements IObjectActionDelegate, IViewActionDelegate { - // The current selection - protected IStructuredSelection selection; - - // The shell, required for the progress dialog - protected Shell shell; - - // Constants for determining the type of progress. Subclasses may - // pass one of these values to the run method. - public final static int PROGRESS_DIALOG = 1; - public final static int PROGRESS_BUSYCURSOR = 2; - public final static int PROGRESS_WORKBENCH_WINDOW = 3; - - private IWorkbenchPart targetPart; - - /** - * Creates an array of the given class type containing all the - * objects in the selection that adapt to the given class. - * - * @param selection - * @param c - * @return - */ - public static Object[] getSelectedAdaptables(ISelection selection, Class c) { - ArrayList result = null; - if (!selection.isEmpty()) { - result = new ArrayList(); - Iterator elements = ((IStructuredSelection) selection).iterator(); - while (elements.hasNext()) { - Object adapter = getAdapter(elements.next(), c); - if (c.isInstance(adapter)) { - result.add(adapter); - } - } - } - if (result != null && !result.isEmpty()) { - return (Object[])result.toArray((Object[])Array.newInstance(c, result.size())); - } - return (Object[])Array.newInstance(c, 0); - } - - /** - * Find the object associated with the given object when it is adapted to - * the provided class. Null is returned if the given object does not adapt - * to the given class - * - * @param selection - * @param c - * @return Object - */ - public static Object getAdapter(Object adaptable, Class c) { - if (c.isInstance(adaptable)) { - return adaptable; - } - if (adaptable instanceof IAdaptable) { - IAdaptable a = (IAdaptable) adaptable; - Object adapter = a.getAdapter(c); - if (c.isInstance(adapter)) { - return adapter; - } - } - return null; - } - - /** - * Returns the selected projects. - * - * @return the selected projects - */ - protected IProject[] getSelectedProjects() { - IResource[] selectedResources = getSelectedResources(); - if (selectedResources.length == 0) return new IProject[0]; - ArrayList projects = new ArrayList(); - for (int i = 0; i < selectedResources.length; i++) { - IResource resource = selectedResources[i]; - if (resource.getType() == IResource.PROJECT) { - projects.add(resource); - } - } - return (IProject[]) projects.toArray(new IProject[projects.size()]); - } - - /** - * Returns an array of the given class type c that contains all - * instances of c that are either contained in the selection or - * are adapted from objects contained in the selection. - * - * @param c - * @return - */ - protected Object[] getSelectedResources(Class c) { - return getSelectedAdaptables(selection, c); - } - - /** - * Returns the selected resources. - * - * @return the selected resources - */ - protected IResource[] getSelectedResources() { - return (IResource[])getSelectedResources(IResource.class); - } - - /** - * Convenience method for getting the current shell. - * - * @return the shell - */ - protected Shell getShell() { - if (shell != null) { - return shell; - } else { - IWorkbench workbench = TeamUIPlugin.getPlugin().getWorkbench(); - if (workbench == null) return null; - IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); - if (window == null) return null; - return window.getShell(); - } - } - /** - * Convenience method for running an operation with progress and - * error feedback. - * - * @param runnable the runnable which executes the operation - * @param problemMessage the message to display in the case of errors - * @param progressKind one of PROGRESS_BUSYCURSOR or PROGRESS_DIALOG - */ - final protected void run(final IRunnableWithProgress runnable, final String problemMessage, int progressKind) { - final Exception[] exceptions = new Exception[] {null}; - switch (progressKind) { - case PROGRESS_WORKBENCH_WINDOW : - try { - PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(true, true, runnable); - } catch (InterruptedException e1) { - exceptions[0] = null; - e1.printStackTrace(); - } catch (InvocationTargetException e) { - exceptions[0] = e; - } - break; - case PROGRESS_BUSYCURSOR : - BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { - public void run() { - try { - runnable.run(new NullProgressMonitor()); - } catch (InvocationTargetException e) { - exceptions[0] = e; - } catch (InterruptedException e) { - exceptions[0] = null; - } - } - }); - break; - default : - case PROGRESS_DIALOG : - try { - new ProgressMonitorDialog(getShell()).run(true, true, runnable); - } catch (InvocationTargetException e) { - exceptions[0] = e; - } catch (InterruptedException e) { - exceptions[0] = null; - } - break; - } - if (exceptions[0] != null) { - handle(exceptions[0], null, problemMessage); - } - } - - /* - * Method declared on IActionDelegate. - */ - public void selectionChanged(IAction action, ISelection selection) { - if (selection instanceof IStructuredSelection) { - this.selection = (IStructuredSelection) selection; - if (action != null) { - setActionEnablement(action); - } - } - } - - /** - * Method invoked from <code>selectionChanged(IAction, ISelection)</code> - * to set the enablement status of the action. The instance variable - * <code>selection</code> will contain the latest selection so the methods - * <code>getSelectedResources()</code> and <code>getSelectedProjects()</code> - * will provide the proper objects. - * - * This method can be overridden by subclasses but should not be invoked by them. - */ - protected void setActionEnablement(IAction action) { - try { - action.setEnabled(isEnabled()); - } catch (TeamException e) { - if (e.getStatus().getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL) { - // Enable the action to allow the user to discover the problem - action.setEnabled(true); - } else { - action.setEnabled(false); - // We should not open a dialog when determining menu enablements so log it instead - TeamPlugin.log(e); - } - } - } - - /* - * Method declared on IObjectActionDelegate. - */ - public void setActivePart(IAction action, IWorkbenchPart targetPart) { - if(targetPart != null) { - this.shell = targetPart.getSite().getShell(); - this.targetPart = targetPart; - } - } - /** - * Shows the given errors to the user. - * - * @param status the status containing the error - * @param title the title of the error dialog - * @param message the message for the error dialog - * @param shell the shell to open the error dialog in - */ - protected void handle(Exception exception, String title, String message) { - Utils.handleError(getShell(), exception, title, message); - } - - /** - * Concrete action enablement code. - * Subclasses must implement. - * - * @return whether the action is enabled - * @throws TeamException if an error occurs during enablement detection - */ - abstract protected boolean isEnabled() throws TeamException; - - /** - * Convenience method that maps the selected resources to their providers. - * The returned Hashtable has keys which are ITeamProviders, and values - * which are Lists of IResources that are shared with that provider. - * - * @return a hashtable mapping providers to their selected resources - */ - protected Hashtable getProviderMapping() { - return getProviderMapping(getSelectedResources()); - } - /** - * Convenience method that maps the given resources to their providers. - * The returned Hashtable has keys which are ITeamProviders, and values - * which are Lists of IResources that are shared with that provider. - * - * @return a hashtable mapping providers to their resources - */ - protected Hashtable getProviderMapping(IResource[] resources) { - Hashtable result = new Hashtable(); - for (int i = 0; i < resources.length; i++) { - RepositoryProvider provider = RepositoryProvider.getProvider(resources[i].getProject()); - List list = (List)result.get(provider); - if (list == null) { - list = new ArrayList(); - result.put(provider, list); - } - list.add(resources[i]); - } - return result; - } - - /** - * @return IWorkbenchPart - */ - protected IWorkbenchPart getTargetPart() { - return targetPart; - } - - /** - * Return the path that was active when the menu item was selected. - * @return IWorkbenchPage - */ - protected IWorkbenchPage getTargetPage() { - if (getTargetPart() == null) return TeamUIPlugin.getActivePage(); - return getTargetPart().getSite().getPage(); - } - - /** - * Show the view with the given ID in the perspective from which the action - * was executed. Returns null if the view is not registered. - * - * @param viewId - * @return IViewPart - */ - protected IViewPart showView(String viewId) { - try { - return getTargetPage().showView(viewId); - } catch (PartInitException pe) { - return null; - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) - */ - public void init(IViewPart view) { - targetPart = view; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamOperation.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamOperation.java deleted file mode 100644 index ad3dfeece..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamOperation.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.actions; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.core.runtime.jobs.JobChangeAdapter; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchSite; - -/** - * An operation that can be configured to run in the foreground using - * the {@link org.eclipse.ui.progress.IProgressService} or the background - * as a {@link org.eclipse.core.runtime.Job}. The executione context is determined - * by what is returned by the {@link #canRunAsJob()} hint which may be overriden by subclasses. - * Subsclass must override the <code>run(IProgressMonitor)</code> method to perform - * the behavior of the operation in the desired execution context. - * <p> - * If this operation is run as a job, it is registered with the job as a - * {@link org.eclipse.core.runtime.jobs.IJobChangeListener} and is scheduled with - * the part of this operation if it is not <code>null</code>. - * Subsclasses can override the methods of this - * interface to receive job change notificaton. - * - * @see org.eclipse.ui.progress.IProgressService - * @see org.eclipse.core.runtime.Job - * @see org.eclipse.core.runtime.ISchedulingRule - * @see org.eclipse.core.runtime.jobs.IJobChangeListener - */ -public abstract class TeamOperation extends JobChangeAdapter implements IRunnableWithProgress { - - private IWorkbenchPart part; - - /** - * Create an team operation associated with the given part. - * @param part the part the operation is associated with or <code>null</code> - */ - protected TeamOperation(IWorkbenchPart part) { - this.part = part; - } - - /** - * Run the operation in a context that is determined by the <code>canRunAsJob()</code> - * hint. If this operation can run as a job then it will be run in a background thread. - * Otherwise it will run in the foreground and block the caller. - */ - public final void run() throws InvocationTargetException, InterruptedException { - getRunnableContext().run(this); - } - - /** - * Returns the scheduling rule that is to be obtained before this - * operation is executed by it's context or <code>null</code> if - * no scheduling rule is to be obtained. If the operation is run - * as a job, the schdulin rule is used as the schduling rule of the - * job. Otherwise, it is obtained before execution of the operation - * occurs. - * <p> - * By default, no scheduling - * rule is obtained. Sublcasses can override to in order ot obtain a - * scheduling rule or can obtain schduling rules withing their operation - * if finer grained schduling is desired. - * @return the schduling rule to be obtained by this operation - * or <code>null</code> - */ - protected ISchedulingRule getSchedulingRule() { - return null; - } - - /** - * Return whether the auto-build should be postponed until after - * the operation is complete. The default is to postpone the auto-build. - * subclas can override. - * @return whether to postpone the auto-build while the operation is executing - */ - protected boolean isPostponeAutobuild() { - return true; - } - - /** - * If this operation can safely be run in the background, then subclasses can - * override this method and return <code>true</code>. This will make their - * action run in a {@link org.eclipse.core.runtime.Job}. - * Subsclass that override this method should - * also override the <code>getJobName()</code> method. - * - * @return <code>true</code> if this action can be run in the background and - * <code>false</code> otherwise. - */ - protected boolean canRunAsJob() { - return false; - } - - /** - * Return the job name to be used if the action can run as a job. (i.e. - * if <code>canRunAsJob()</code> returns <code>true</code>). - * - * @return the string to be used as the job name - */ - protected String getJobName() { - return ""; //$NON-NLS-1$ - } - - /** - * Return a shell that can be used by the operation to display dialogs, etc. - * @return a shell - */ - protected Shell getShell() { - return Utils.getShell(getSite()); - } - - /* - * Uses the {@link #canRunAsJob()} hint to return a {@link ITeamRunnableContext} - * that is used to execute the <code>run(SyncInfoSet, IProgressMonitor)</code> - * method of this action. - * - * @param syncSet the sync info set containing the selected elements for which this - * action is enabled. - * @return the runnable context in which to run this action. - */ - private ITeamRunnableContext getRunnableContext() { - if (canRunAsJob()) { - JobRunnableContext context = new JobRunnableContext(getJobName(), this, getSite()); - context.setPostponeBuild(isPostponeAutobuild()); - context.setSchedulingRule(getSchedulingRule()); - return context; - } else { - ProgressDialogRunnableContext context = new ProgressDialogRunnableContext(getShell()); - context.setPostponeBuild(isPostponeAutobuild()); - context.setSchedulingRule(getSchedulingRule()); - return context; - } - } - - private IWorkbenchSite getSite() { - IWorkbenchSite site = null; - if(part != null) { - site = part.getSite(); - } - return site; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java deleted file mode 100644 index 53069ba25..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java +++ /dev/null @@ -1,306 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.dialogs; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.*; - -/** - * A simple superclass for detail button dialogs. - */ -abstract public class DetailsDialog extends Dialog { - /** - * The Details button. - */ - private Button detailsButton; - - /** - * The Ok button. - */ - private Button okButton; - - /** - * The title of the dialog. - */ - private String title; - - /** - * The error message - */ - private Label errorMessageLabel; - - /** - * The SWT list control that displays the error details. - */ - private Composite detailsComposite; - - /** - * Indicates whether the error details viewer is currently created. - */ - private boolean detailsCreated = false; - - /** - * The key for the image to be displayed (one of the image constants on Dialog) - */ - private String imageKey = null; - - /** - * Creates a details pane dialog. - * Note that the dialog will have no visual representation (no widgets) - * until it is told to open. - * - * @param parentShell the shell under which to create this dialog - * @param dialogTitle the title to use for this dialog - * @param message the message to show in this dialog - * @param status the error to show to the user - * @param displayMask the mask to use to filter the displaying of child items, - * as per <code>IStatus.matches</code> - * @see org.eclipse.core.runtime.IStatus#matches - */ - public DetailsDialog(Shell parentShell, String dialogTitle) { - super(parentShell); - this.title = dialogTitle; - setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL); - } - - /* (non-Javadoc) - * Method declared on Dialog. - * Handles the pressing of the Ok or Details button in this dialog. - * If the Ok button was pressed then close this dialog. If the Details - * button was pressed then toggle the displaying of the error details area. - * Note that the Details button will only be visible if the error being - * displayed specifies child details. - */ - protected void buttonPressed(int id) { - if (id == IDialogConstants.DETAILS_ID) { // was the details button pressed? - toggleDetailsArea(); - } else { - super.buttonPressed(id); - } - } - - /* (non-Javadoc) - * Method declared in Window. - */ - protected void configureShell(Shell shell) { - super.configureShell(shell); - shell.setText(title); - } - - /* (non-Javadoc) - * Method declared on Dialog. - */ - protected void createButtonsForButtonBar(Composite parent) { - // create OK and Details buttons - if(includeOkButton()) { - okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); - } - if (includeCancelButton()) { - createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); - } - if(includeDetailsButton()) { - detailsButton = createButton(parent, IDialogConstants.DETAILS_ID, getDetailsButtonLabelShow(), false); - } - updateEnablements(); - } - - protected String getDetailsButtonLabelShow() { - return IDialogConstants.SHOW_DETAILS_LABEL; - } - - protected String getDetailsButtonLabelHide() { - return IDialogConstants.HIDE_DETAILS_LABEL; - } - - /* (non-Javadoc) - * Method declared on Dialog. - * Creates and returns the contents of the upper part - * of the dialog (above the button bar). - */ - final protected Control createDialogArea(Composite parent) { - // create composite - Composite composite = (Composite)super.createDialogArea(parent); - - // create image - Image image = JFaceResources.getImageRegistry().get(getImageKey()); - if (image != null) { - // create a composite to split the dialog area in two - Composite top = new Composite(composite, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.verticalSpacing = 0; - layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); - layout.numColumns = 2; - top.setLayout(layout); - top.setLayoutData(new GridData(GridData.FILL_BOTH)); - - // add the image to the left of the composite - Label label = new Label(top, 0); - image.setBackground(label.getBackground()); - label.setImage(image); - label.setLayoutData(new GridData( - GridData.HORIZONTAL_ALIGN_CENTER | - GridData.VERTICAL_ALIGN_BEGINNING)); - - // add a composite to the right to contain the custom components - Composite right = new Composite(top, SWT.NONE); - layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); - layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); - right.setLayout(layout); - right.setLayoutData(new GridData(GridData.FILL_BOTH)); - createMainDialogArea(right); - } else { - createMainDialogArea(composite); - } - - if(includeErrorMessage()) { - errorMessageLabel = new Label(composite, SWT.NONE); - errorMessageLabel.setLayoutData(new GridData( - GridData.GRAB_HORIZONTAL | - GridData.HORIZONTAL_ALIGN_FILL)); - errorMessageLabel.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_RED)); - } - - Dialog.applyDialogFont(parent); - return composite; - } - - /** - * Creates the dialog's top composite - * - * @param parent the parent composite - */ - abstract protected void createMainDialogArea(Composite parent); - - /** - * Create this dialog's drop-down list component. - * - * @param parent the parent composite - * @return the drop-down list component - */ - abstract protected Composite createDropDownDialogArea(Composite parent); - - /** - * Toggles the unfolding of the details area. This is triggered by - * the user pressing the details button. - */ - private void toggleDetailsArea() { - Point windowSize = getShell().getSize(); - Point oldSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT); - - if (detailsCreated) { - detailsComposite.dispose(); - detailsCreated = false; - detailsButton.setText(getDetailsButtonLabelShow()); - } else { - detailsComposite = createDropDownDialogArea((Composite)getContents()); - detailsCreated = true; - detailsButton.setText(getDetailsButtonLabelHide()); - } - Dialog.applyDialogFont(getContents()); - Point newSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT); - - getShell().setSize(new Point(windowSize.x, windowSize.y + (newSize.y - oldSize.y))); - } - - final protected void setErrorMessage(String error) { - if(errorMessageLabel != null) { - if(error == null || error.length() == 0) { - errorMessageLabel.setText(""); //$NON-NLS-1$ - } else { - errorMessageLabel.setText(error); - } - errorMessageLabel.update(); - } - } - - final protected void setPageComplete(boolean complete) { - if(okButton != null ) { - okButton.setEnabled(complete); - } - } - - abstract protected void updateEnablements(); - - protected boolean includeCancelButton() { - return true; - } - - protected boolean includeOkButton() { - return true; - } - - /** - * Returns the imageKey. - * @return String - */ - protected String getImageKey() { - return imageKey; - } - - - /** - * Sets the imageKey. - * @param imageKey The imageKey to set - */ - protected void setImageKey(String imageKey) { - this.imageKey = imageKey; - } - - protected static final int LABEL_WIDTH_HINT = 400; - protected Label createWrappingLabel(Composite parent, String text) { - Label label = new Label(parent, SWT.LEFT | SWT.WRAP); - label.setText(text); - GridData data = new GridData(); - data.horizontalSpan = 1; - data.horizontalAlignment = GridData.FILL; - data.horizontalIndent = 0; - data.grabExcessHorizontalSpace = true; - data.widthHint = LABEL_WIDTH_HINT; - label.setLayoutData(data); - return label; - } - - protected Composite createComposite(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); - layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); - layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); - layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - return composite; - } - - protected boolean isDetailsVisible() { - return detailsCreated; - } - - protected boolean includeErrorMessage() { - return true; - } - - protected boolean includeDetailsButton() { - return true; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialogWithProjects.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialogWithProjects.java deleted file mode 100644 index 30dcc23c6..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialogWithProjects.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.dialogs; - -import org.eclipse.core.resources.IProject; -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.*; - -/** - * Display a message with a details that can contain a list of projects - */ -public class DetailsDialogWithProjects extends DetailsDialog { - - private String message; - private String detailsTitle; - private IProject[] projects; - private org.eclipse.swt.widgets.List detailsList; - - private boolean includeCancelButton; - - /** - * Constructor for DetailsDialogWithProjects. - * @param parentShell - * @param dialogTitle - */ - public DetailsDialogWithProjects(Shell parentShell, String dialogTitle, String dialogMessage, String detailsTitle, IProject[] projects, boolean includeCancelButton, String imageKey) { - super(parentShell, dialogTitle); - setImageKey(imageKey); - this.message = dialogMessage; - this.detailsTitle = detailsTitle; - this.projects = projects; - this.includeCancelButton = includeCancelButton; - } - - /** - * @see DetailsDialog#createMainDialogArea(Composite) - */ - protected void createMainDialogArea(Composite composite) { - Label label = new Label(composite, SWT.WRAP); - label.setText(message); //$NON-NLS-1$ - GridData data = new GridData( - GridData.GRAB_HORIZONTAL | - GridData.GRAB_VERTICAL | - GridData.HORIZONTAL_ALIGN_FILL | - GridData.VERTICAL_ALIGN_CENTER); - data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); - label.setLayoutData(data); - updateEnablements(); - } - - /** - * @see DetailsDialog#createDropDownDialogArea(Composite) - */ - protected Composite createDropDownDialogArea(Composite parent) { - // create a composite with standard margins and spacing - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); - layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); - layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); - layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - - detailsList = new org.eclipse.swt.widgets.List(composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - GridData data = new GridData (); - data.heightHint = 75; - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - detailsList.setLayoutData(data); - - if (detailsTitle != null) { - detailsList.add(detailsTitle); - } - - for (int i = 0; i < projects.length; i++) { - IProject project = projects[i]; - detailsList.add(projects[i].getName()); //$NON-NLS-1$ - } - return composite; - } - - /** - * @see DetailsDialog#updateEnablements() - */ - protected void updateEnablements() { - setPageComplete(true); - } - - /** - * @see DetailsDialog#includeCancelButton() - */ - protected boolean includeCancelButton() { - return includeCancelButton; - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DialogArea.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DialogArea.java deleted file mode 100644 index 1275112a2..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DialogArea.java +++ /dev/null @@ -1,205 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.dialogs; - -import java.util.*; -import java.util.List; - -import org.eclipse.jface.dialogs.*; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.*; - -/** - * This class provides facilities to allow common widget groupings to be shared - * by mulitple dialogs or wizards. - */ -public abstract class DialogArea { - - protected static final int LABEL_WIDTH_HINT = 400; - - protected Dialog parentDialog; - protected FontMetrics fontMetrics; - protected IDialogSettings settings; - - protected List listeners; - - public DialogArea(Dialog parentDialog, IDialogSettings settings) { - this.listeners = new ArrayList(); - this.parentDialog = parentDialog; - this.settings = settings; - } - - /** - * Listener for property change events. The only event of interest is for - * property SELECTED_WORKING_SET which contains the selected working set or - * <code>null</code> if none is selected. - * - * @param listener - */ - public void addPropertyChangeListener(IPropertyChangeListener listener) { - if (!listeners.contains(listener)) - listeners.add(listener); - } - /** - * Remove the provided listener from the receiver. - * - * @param listener - */ - public void removePropertyChangeListener(IPropertyChangeListener listener) { - listeners.remove(listener); - } - - protected void firePropertyChangeChange(String property, Object oldValue, Object newValue) { - PropertyChangeEvent event = new PropertyChangeEvent(this, property, oldValue, newValue); - for (Iterator iter = listeners.iterator(); iter.hasNext();) { - IPropertyChangeListener listener = (IPropertyChangeListener) iter.next(); - listener.propertyChange(event); - } - } - - /** - * Code copied from <code>org.eclipse.jface.dialogs.Dialog</code> to obtain - * a FontMetrics. - * - * @param control a control from which to obtain the current font - * - * @see org.eclipse.jface.dialogs.Dialog - */ - protected void initializeDialogUnits(Control control) { - // Compute and store a font metric - GC gc = new GC(control); - gc.setFont(control.getFont()); - fontMetrics = gc.getFontMetrics(); - gc.dispose(); - } - - public abstract Control createArea(Composite parent); - - /** - * Returns the shell. - * @return Shell - */ - protected Shell getShell() { - return parentDialog.getShell(); - } - - protected Button createCheckbox(Composite parent, String label, int span) { - Button button = new Button(parent, SWT.CHECK | SWT.LEFT); - button.setText(label); - button.setFont(parent.getFont()); - GridData data = new GridData(); - data.horizontalSpan = span; - button.setLayoutData(data); - return button; - } - - protected Button createButton(Composite parent, String label, int style) { - Button button = new Button(parent, SWT.PUSH); - button.setText(label); - // we need to explicitly set the font to the parent's font for dialogs - button.setFont(parent.getFont()); - GridData data = new GridData(style); - data.heightHint = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_HEIGHT); - int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - button.setLayoutData(data);; - return button; - } - - protected Button createRadioButton(Composite parent, String label, int span) { - Button button = new Button(parent, SWT.RADIO); - button.setText(label); - GridData data = new GridData(); - data.horizontalSpan = span; - button.setLayoutData(data); - return button; - } - protected Label createWrappingLabel(Composite parent, String text, int horizontalSpan) { - Label label = new Label(parent, SWT.LEFT | SWT.WRAP); - label.setText(text); - label.setFont(parent.getFont()); - GridData data = new GridData(); - data.horizontalSpan = horizontalSpan; - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - data.widthHint = LABEL_WIDTH_HINT; - label.setLayoutData(data); - return label; - } - protected Label createLabel(Composite parent, String text, int horizontalSpan) { - Label label = new Label(parent, SWT.LEFT); - label.setText(text); - GridData data = new GridData(); - data.horizontalSpan = horizontalSpan; - data.horizontalAlignment = GridData.FILL; - label.setLayoutData(data); - return label; - } - /** - * Creates composite control and sets the default layout data. - * - * @param parent the parent of the new composite - * @param numColumns the number of columns for the new composite - * @return the newly-created coposite - */ - protected Composite createComposite(Composite parent, int numColumns) { - Composite composite = new Composite(parent, SWT.NULL); - Font font = parent.getFont(); - composite.setFont(parent.getFont()); - - // GridLayout - GridLayout layout = new GridLayout(); - layout.numColumns = numColumns; - composite.setLayout(layout); - - // GridData - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - return composite; - } - - /** - * Creates composite control and sets the default layout data. - * - * @param parent the parent of the new composite - * @param numColumns the number of columns for the new composite - * @return the newly-created coposite - */ - protected Composite createGrabbingComposite(Composite parent, int numColumns) { - Composite composite = new Composite(parent, SWT.NULL); - Font font = parent.getFont(); - composite.setFont(parent.getFont()); - - // GridLayout - GridLayout layout = new GridLayout(); - layout.numColumns = numColumns; - layout.marginHeight = 0; - layout.marginWidth = 0; - composite.setLayout(layout); - - // GridData - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - data.grabExcessVerticalSpace = true; - composite.setLayoutData(data); - return composite; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/IPromptCondition.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/IPromptCondition.java deleted file mode 100644 index 79f9b6c81..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/IPromptCondition.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.dialogs; - -import org.eclipse.core.resources.IResource; - -/** - * Input to a confirm prompt - * - * @see PromptingDialog - */ -public interface IPromptCondition { - /** - * Answers <code>true</code> if a prompt is required for this resource and - * false otherwise. - */ - public boolean needsPrompt(IResource resource); - - /** - * Answers the message to include in the prompt. - */ - public String promptMessage(IResource resource); -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java deleted file mode 100644 index 3bc3b6a5d..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java +++ /dev/null @@ -1,395 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.dialogs; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.preference.*; -import org.eclipse.jface.resource.*; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.*; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.Utils; - -public class PreferencePageContainerDialog extends Dialog implements IPreferencePageContainer { - - PreferencePage page; - - private class PageLayout extends Layout { - public void layout(Composite composite, boolean force) { - Rectangle rect = composite.getClientArea(); - Control [] children = composite.getChildren(); - for (int i= 0; i < children.length; i++) { - children[i].setSize(rect.width, rect.height); - } - } - public Point computeSize(Composite composite, int wHint, int hHint, boolean force) { - if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT) - return new Point(wHint, hHint); - int x= fMinimumPageSize.x; - int y= fMinimumPageSize.y; - - Control[] children= composite.getChildren(); - for (int i= 0; i < children.length; i++) { - Point size= children[i].computeSize(SWT.DEFAULT, SWT.DEFAULT, force); - x= Math.max(x, size.x); - y= Math.max(y, size.y); - } - if (wHint != SWT.DEFAULT) x = wHint; - if (hHint != SWT.DEFAULT) y = hHint; - return new Point(x, y); - } - } - - private Composite fTitleArea; - private Label fTitleImage; - private CLabel fMessageLabel; - - private String fMessage; - private Color fNormalMsgAreaBackground; - private Image fErrorMsgImage; - - private Button fOkButton; - - /** - * Must declare our own images as the JFaceResource images will not be created unless - * a property/preference dialog has been shown - */ - protected static final String PREF_DLG_TITLE_IMG = "preference_page_container_image";//$NON-NLS-1$ - protected static final String PREF_DLG_IMG_TITLE_ERROR = "preference_page_container_title_error_image";//$NON-NLS-1$ - static { - ImageRegistry reg = TeamUIPlugin.getPlugin().getImageRegistry(); - reg.put(PREF_DLG_TITLE_IMG, ImageDescriptor.createFromFile(PreferenceDialog.class, "images/pref_dialog_title.gif"));//$NON-NLS-1$ - reg.put(PREF_DLG_IMG_TITLE_ERROR, ImageDescriptor.createFromFile(Dialog.class, "images/message_error.gif"));//$NON-NLS-1$ - } - - /** - * The Composite in which a page is shown. - */ - private Composite fPageContainer; - - /** - * The minimum page size; 200 by 200 by default. - * - * @see #setMinimumPageSize(Point) - */ - private Point fMinimumPageSize = new Point(200,200); - - public PreferencePageContainerDialog(Shell shell, PreferencePage page) { - super(shell); - this.page = page; - } - - /** - * @see Dialog#okPressed() - */ - protected void okPressed() { - final List changedProperties = new ArrayList(5); - getPreferenceStore().addPropertyChangeListener( new IPropertyChangeListener() { - public void propertyChange(PropertyChangeEvent event) { - changedProperties.add(event.getProperty()); - } - }); - - page.performOk(); - - handleSave(); - - super.okPressed(); - } - - /** - * Sets the title for this dialog. - * @param title the title. - */ - public void setTitle(String title) { - Shell shell= getShell(); - if ((shell != null) && !shell.isDisposed()) { - shell.setText(title); - } - } - - /** - * @see Dialog#createDialogArea(Composite) - */ - protected Control createDialogArea(Composite parent) { - Composite composite = (Composite)super.createDialogArea(parent); - ((GridLayout) composite.getLayout()).numColumns = 1; - - // Build the title area and separator line - Composite titleComposite = new Composite(composite, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.verticalSpacing = 0; - layout.horizontalSpacing = 0; - titleComposite.setLayout(layout); - titleComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - createTitleArea(titleComposite); - - Label titleBarSeparator = new Label(titleComposite, SWT.HORIZONTAL | SWT.SEPARATOR); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - titleBarSeparator.setLayoutData(gd); - - // Build the Page container - fPageContainer = createPageContainer(composite); - fPageContainer.setLayoutData(new GridData(GridData.FILL_BOTH)); - - page.setContainer(this); - page.createControl(fPageContainer); - setTitle(page.getTitle()); - - // Build the separator line - Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - separator.setLayoutData(gd); - - applyDialogFont(parent); - return composite; - } - - /** - * Creates the dialog's title area. - * - * @param parent the SWT parent for the title area composite - * @return the created title area composite - */ - private Composite createTitleArea(Composite parent) { - Font font = parent.getFont(); - - // Create the title area which will contain - // a title, message, and image. - fTitleArea = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.verticalSpacing = 0; - layout.horizontalSpacing = 0; - layout.numColumns = 2; - - // Get the colors for the title area - Display display = parent.getDisplay(); - Color bg = JFaceColors.getBannerBackground(display); - Color fg = JFaceColors.getBannerForeground(display); - - GridData layoutData = new GridData(GridData.FILL_BOTH); - fTitleArea.setLayout(layout); - fTitleArea.setLayoutData(layoutData); - fTitleArea.setBackground(bg); - - // Message label - fMessageLabel = new CLabel(fTitleArea, SWT.LEFT); - fMessageLabel.setBackground(bg); - fMessageLabel.setForeground(fg); - fMessageLabel.setText(" ");//$NON-NLS-1$ - fMessageLabel.setFont(JFaceResources.getBannerFont()); - - final IPropertyChangeListener fontListener = new IPropertyChangeListener() { - public void propertyChange(PropertyChangeEvent event) { - if(JFaceResources.BANNER_FONT.equals(event.getProperty()) || - JFaceResources.DIALOG_FONT.equals(event.getProperty())) { - updateMessage(); - } - } - }; - - fMessageLabel.addDisposeListener(new DisposeListener() { - public void widgetDisposed(DisposeEvent event) { - JFaceResources.getFontRegistry().removeListener(fontListener); - } - }); - - JFaceResources.getFontRegistry().addListener(fontListener); - - GridData gd = new GridData(GridData.FILL_BOTH); - fMessageLabel.setLayoutData(gd); - - // Title image - fTitleImage = new Label(fTitleArea, SWT.LEFT); - fTitleImage.setBackground(bg); - fTitleImage.setImage(TeamUIPlugin.getPlugin().getImageRegistry().get(PREF_DLG_TITLE_IMG)); - gd = new GridData(); - gd.horizontalAlignment = GridData.END; - fTitleImage.setLayoutData(gd); - updateMessage(); - return fTitleArea; - } - - /** - * Creates the inner page container. - */ - private Composite createPageContainer(Composite parent) { - Composite result = new Composite(parent, SWT.NULL); - result.setLayout(new PageLayout()); - return result; - } - - /** - * Sets the minimum page size. - * - * @param size the page size encoded as - * <code>new Point(width,height)</code> - * @see #setMinimumPageSize(int,int) - */ - public void setMinimumPageSize(Point size) { - fMinimumPageSize.x = size.x; - fMinimumPageSize.y = size.y; - } - - /** - * Display the given error message. The currently displayed message - * is saved and will be redisplayed when the error message is set - * to <code>null</code>. - * - * @param errorMessage the errorMessage to display or <code>null</code> - */ - public void setErrorMessage(String errorMessage) { - if (errorMessage == null) { - if (fMessageLabel.getImage() != null) { - // we were previously showing an error - fMessageLabel.setBackground(fNormalMsgAreaBackground); - fMessageLabel.setImage(null); - fTitleImage.setImage(TeamUIPlugin.getPlugin().getImageRegistry().get(PREF_DLG_TITLE_IMG)); - fTitleArea.layout(true); - } - - // show the message - setMessage(fMessage); - - } else { - fMessageLabel.setText(errorMessage); - if (fMessageLabel.getImage() == null) { - // we were not previously showing an error - - // lazy initialize the error background color and image - if (fErrorMsgImage == null) { - fErrorMsgImage = TeamUIPlugin.getPlugin().getImageRegistry().get(PREF_DLG_IMG_TITLE_ERROR); - } - - // show the error - fNormalMsgAreaBackground = fMessageLabel.getBackground(); - fMessageLabel.setBackground(JFaceColors.getErrorBackground(fMessageLabel.getDisplay())); - fMessageLabel.setImage(fErrorMsgImage); - fTitleImage.setImage(null); - fTitleArea.layout(true); - } - } - } - /** - * Set the message text. If the message line currently displays an error, - * the message is stored and will be shown after a call to clearErrorMessage - */ - public void setMessage(String newMessage) { - fMessage = newMessage; - if (fMessage == null) { - fMessage = "";//$NON-NLS-1$ - } - if (fMessageLabel.getImage() == null) { - // we are not showing an error - fMessageLabel.setText(fMessage); - } - } - - /** - * @see IPreferencePageContainer#updateMessage() - */ - public void updateMessage() { - String pageMessage = page.getMessage(); - String pageErrorMessage = page.getErrorMessage(); - - // Adjust the font - if (pageMessage == null && pageErrorMessage == null) - fMessageLabel.setFont(JFaceResources.getBannerFont()); - else - fMessageLabel.setFont(JFaceResources.getDialogFont()); - - // Set the message and error message - if (pageMessage == null) { - setMessage(page.getTitle()); - } else { - setMessage(pageMessage); - } - setErrorMessage(pageErrorMessage); - } - - /** - * @see IPreferencePageContainer#getPreferenceStore() - */ - public IPreferenceStore getPreferenceStore() { - return page.getPreferenceStore(); - } - - /** - * @see IPreferencePageContainer#updateButtons() - */ - public void updateButtons() { - if (fOkButton != null) { - fOkButton.setEnabled(page.isValid()); - } - } - - /** - * @see IPreferencePageContainer#updateTitle() - */ - public void updateTitle() { - setTitle(page.getTitle()); - } - - /** - * @see Dialog#createButtonsForButtonBar(Composite) - */ - protected void createButtonsForButtonBar(Composite parent) { - fOkButton= createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); - createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); - } - - /** - * Save the values specified in the pages. - * <p> - * The default implementation of this framework method saves all - * pages of type <code>PreferencePage</code> (if their store needs saving - * and is a <code>PreferenceStore</code>). - * </p> - * <p> - * Subclasses may override. - * </p> - */ - protected void handleSave() { - if (page instanceof PreferencePage) { - // Save now in case tbe workbench does not shutdown cleanly - IPreferenceStore store = - ((PreferencePage) page).getPreferenceStore(); - if (store != null - && store.needsSaving() - && store instanceof IPersistentPreferenceStore) { - try { - ((IPersistentPreferenceStore) store).save(); - } catch (IOException e) { - Utils.handle(e); - } - } - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PromptingDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PromptingDialog.java deleted file mode 100644 index 1f40ecd2b..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PromptingDialog.java +++ /dev/null @@ -1,126 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.dialogs; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.widgets.Shell; - -/** - * A confirmation dialog helper that will either show a 'yes/no/yes to all/cancel' - * dialog to confirm an action performed on several resources or if only one - * resource is specified 'ok/cancel' will be shown. - */ -public class PromptingDialog { - private IResource[] resources; - private Shell shell; - private String[] buttons; - private boolean confirmOverwrite = true; - private IPromptCondition condition; - private String title; - private boolean hasMultipleResources; - private boolean allOrNothing; - - /** - * Prompt for the given resources using the specific condition. The prompt dialog will - * have the title specified. - */ - public PromptingDialog(Shell shell, IResource[] resources, IPromptCondition condition, String title) { - this(shell, resources, condition, title, false /* all or nothing */); - } - - public PromptingDialog(Shell shell, IResource[] resources, IPromptCondition condition, String title, boolean allOrNothing) { - this.condition = condition; - this.resources = resources; - this.title = title; - this.shell = shell; - this.hasMultipleResources = resources.length > 1; - this.allOrNothing = allOrNothing; - if (hasMultipleResources) { - if (allOrNothing) { - buttons = new String[] { - IDialogConstants.YES_LABEL, - IDialogConstants.YES_TO_ALL_LABEL, - IDialogConstants.CANCEL_LABEL}; - } else { - buttons = new String[] { - IDialogConstants.YES_LABEL, - IDialogConstants.YES_TO_ALL_LABEL, - IDialogConstants.NO_LABEL, - IDialogConstants.CANCEL_LABEL}; - } - } else { - buttons = new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL}; - } - } - /** - * Call to calculate and show prompt. If no resources satisfy the prompt condition - * a dialog won't be shown. The resources for which the user confirmed the action - * are returned. - */ - public IResource[] promptForMultiple() throws InterruptedException { - List targetResources = new ArrayList(); - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - if (condition.needsPrompt(resource) && confirmOverwrite) { - if (confirmOverwrite(condition.promptMessage(resource))) { - targetResources.add(resource); - } - } else { - targetResources.add(resource); - } - } - return (IResource[]) targetResources.toArray(new IResource[targetResources.size()]); - } - - /** - * Opens the confirmation dialog based on the prompt condition settings. - */ - private boolean confirmOverwrite(String msg) throws InterruptedException { - if (!confirmOverwrite) { - return true; - } - final MessageDialog dialog = - new MessageDialog(shell, title, null, msg, MessageDialog.QUESTION, buttons, 0); - - // run in syncExec because callback is from an operation, - // which is probably not running in the UI thread. - shell.getDisplay().syncExec( - new Runnable() { - public void run() { - dialog.open(); - } - }); - if (hasMultipleResources) { - switch (dialog.getReturnCode()) { - case 0://Yes - return true; - case 1://Yes to all - confirmOverwrite = false; - return true; - case 2://No (or CANCEL for all-or-nothing) - if (allOrNothing) { - throw new InterruptedException(); - } - return false; - case 3://Cancel - default: - throw new InterruptedException(); - } - } else { - return dialog.getReturnCode() == 0; - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshChangeListener.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshChangeListener.java deleted file mode 100644 index d5a3d1723..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshChangeListener.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.eclipse.team.internal.ui.jobs; - -import java.util.*; - -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.team.core.subscribers.*; -import org.eclipse.team.core.synchronize.*; - -class RefreshChangeListener implements ISubscriberChangeListener { - private List changes = new ArrayList(); - private SubscriberSyncInfoCollector collector; - - RefreshChangeListener(SubscriberSyncInfoCollector collector) { - this.collector = collector; - } - public void subscriberResourceChanged(ISubscriberChangeEvent[] deltas) { - for (int i = 0; i < deltas.length; i++) { - ISubscriberChangeEvent delta = deltas[i]; - if (delta.getFlags() == ISubscriberChangeEvent.SYNC_CHANGED) { - changes.add(delta); - } - } - } - public SyncInfo[] getChanges() { - collector.waitForCollector(new NullProgressMonitor()); - List changedSyncInfos = new ArrayList(); - SyncInfoSet set = collector.getSubscriberSyncInfoSet(); - for (Iterator it = changes.iterator(); it.hasNext();) { - ISubscriberChangeEvent delta = (ISubscriberChangeEvent) it.next(); - SyncInfo info = set.getSyncInfo(delta.getResource()); - if (info != null && interestingChange(info)) { - changedSyncInfos.add(info); - } - } - return (SyncInfo[]) changedSyncInfos.toArray(new SyncInfo[changedSyncInfos.size()]); - } - - private boolean interestingChange(SyncInfo info) { - int kind = info.getKind(); - if(isThreeWay()) { - int direction = SyncInfo.getDirection(kind); - return (direction == SyncInfo.INCOMING || direction == SyncInfo.CONFLICTING); - } else { - return SyncInfo.getChange(kind) != SyncInfo.IN_SYNC; - } - } - - private boolean isThreeWay() { - return collector.getSubscriber().getResourceComparator().isThreeWay(); - } - - public void clear() { - changes.clear(); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java deleted file mode 100644 index 393936537..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java +++ /dev/null @@ -1,360 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.jobs; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.WorkspaceJob; -import org.eclipse.core.runtime.*; -import org.eclipse.core.runtime.jobs.*; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.subscribers.Subscriber; -import org.eclipse.team.core.subscribers.SubscriberSyncInfoCollector; -import org.eclipse.team.core.synchronize.SyncInfo; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.ui.synchronize.subscriber.IRefreshEvent; -import org.eclipse.team.ui.synchronize.subscriber.IRefreshSubscriberListener; - -/** - * Job to refresh a subscriber with its remote state. - * - * There can be several refresh jobs created but they will be serialized. - * This is accomplished using a synchrnized block on the family id. It is - * important that no scheduling rules are used for the job in order to - * avoid possible deadlock. - */ -public class RefreshSubscriberJob extends WorkspaceJob { - - /** - * Uniquely identifies this type of job. This is used for cancellation. - */ - private final static Object FAMILY_ID = new Object(); - - /** - * If true this job will be restarted when it completes - */ - private boolean reschedule = false; - - /** - * If true a rescheduled refresh job should be retarted when cancelled - */ - private boolean restartOnCancel = true; - - /** - * The schedule delay used when rescheduling a completed job - */ - private static long scheduleDelay; - - /** - * The subscribers and roots to refresh. If these are changed when the job - * is running the job is cancelled. - */ - private IResource[] resources; - private SubscriberSyncInfoCollector collector; - - /** - * Refresh started/completed listener for every refresh - */ - private static List listeners = new ArrayList(1); - - protected static class RefreshEvent implements IRefreshEvent { - int type; - Subscriber subscriber; - SyncInfo[] changes; - long startTime = 0; - long stopTime = 0; - IStatus status; - IResource[] resources; - - RefreshEvent(int type, IResource[] resources, Subscriber subscriber) { - this.type = type; - this.subscriber = subscriber; - this.resources = resources; - } - - public int getRefreshType() { - return type; - } - - public Subscriber getSubscriber() { - return subscriber; - } - - public SyncInfo[] getChanges() { - return changes; - } - - public void setChanges(SyncInfo[] changes) { - this.changes = changes; - } - - /** - * @return Returns the startTime. - */ - public long getStartTime() { - return startTime; - } - - /** - * @param startTime The startTime to set. - */ - public void setStartTime(long startTime) { - this.startTime = startTime; - } - - /** - * @return Returns the stopTime. - */ - public long getStopTime() { - return stopTime; - } - - /** - * @param stopTime The stopTime to set. - */ - public void setStopTime(long stopTime) { - this.stopTime = stopTime; - } - - public IStatus getStatus() { - return status; - } - - public void setStatus(IStatus status) { - this.status = status; - } - - public IResource[] getResources() { - return resources; - } - } - - private abstract class Notification implements ISafeRunnable { - private IRefreshSubscriberListener listener; - public void handleException(Throwable exception) { - // don't log the exception....it is already being logged in Platform#run - } - public void run(IRefreshSubscriberListener listener) { - this.listener = listener; - Platform.run(this); - } - public void run() throws Exception { - notify(listener); - } - /** - * Subsclasses overide this method to send an event safely to a lsistener - * @param listener - */ - protected abstract void notify(IRefreshSubscriberListener listener); - } - - - public RefreshSubscriberJob(String name, IResource[] resources, SubscriberSyncInfoCollector collector) { - this(name, collector); - this.resources = resources; - } - - public RefreshSubscriberJob(String name, SubscriberSyncInfoCollector collector) { - super(name); - - this.collector = collector; - - setPriority(Job.DECORATE); - setRefreshInterval(3600 /* 1 hour */); - - addJobChangeListener(new JobChangeAdapter() { - public void done(IJobChangeEvent event) { - if(shouldReschedule()) { - if(event.getResult().getSeverity() == IStatus.CANCEL && ! restartOnCancel) { - return; - } - RefreshSubscriberJob.this.schedule(scheduleDelay); - restartOnCancel = true; - } - } - }); - } - - public boolean shouldRun() { - // Ensure that any progress shown as a result of this refresh occurs hidden in a progress group. - boolean shouldRun = collector != null && getSubscriber() != null; - if(shouldRun) { - IProgressMonitor group = Platform.getJobManager().createProgressGroup(); - group.beginTask(Policy.bind("RefreshSubscriberJob.2", getSubscriber().getName()), 100); //$NON-NLS-1$ - setProgressGroup(group, 80); - collector.setProgressGroup(group, 20); - } - return shouldRun; - } - - public boolean belongsTo(Object family) { - return family == getFamily(); - } - - public static Object getFamily() { - return FAMILY_ID; - } - - /** - * This is run by the job scheduler. A list of subscribers will be refreshed, errors will not stop the job - * and it will continue to refresh the other subscribers. - */ - public IStatus runInWorkspace(IProgressMonitor monitor) { - // Synchronized to ensure only one refresh job is running at a particular time - synchronized (getFamily()) { - MultiStatus status = new MultiStatus(TeamUIPlugin.ID, TeamException.UNABLE, Policy.bind("RefreshSubscriberJob.0"), null); //$NON-NLS-1$ - Subscriber subscriber = getSubscriber(); - IResource[] roots = getResources(); - - // if there are no resources to refresh, just return - if(subscriber == null || roots == null) { - return Status.OK_STATUS; - } - - monitor.beginTask(null, 100); - RefreshEvent event = new RefreshEvent(reschedule ? IRefreshEvent.SCHEDULED_REFRESH : IRefreshEvent.USER_REFRESH, roots, collector.getSubscriber()); - RefreshChangeListener changeListener = new RefreshChangeListener(collector); - try { - // Only allow one refresh job at a time - // NOTE: It would be cleaner if this was done by a scheduling - // rule but at the time of writting, it is not possible due to - // the scheduling rule containment rules. - event.setStartTime(System.currentTimeMillis()); - if(monitor.isCanceled()) { - return Status.CANCEL_STATUS; - } - try { - // Set-up change listener so that we can determine the changes found - // during this refresh. - subscriber.addListener(changeListener); - // Pre-Notify - notifyListeners(true, event); - // Perform the refresh - subscriber.refresh(roots, IResource.DEPTH_INFINITE, Policy.subMonitorFor(monitor, 100)); - } catch(TeamException e) { - status.merge(e.getStatus()); - } - } catch(OperationCanceledException e2) { - return Status.CANCEL_STATUS; - } finally { - monitor.done(); - } - - // Post-Notify - event.setChanges(changeListener.getChanges()); - event.setStopTime(System.currentTimeMillis()); - event.setStatus(status.isOK() ? Status.OK_STATUS : (IStatus) status); - notifyListeners(false, event); - changeListener.clear(); - - return event.getStatus(); - } - } - - protected IResource[] getResources() { - if(resources != null) { - return resources; - } else { - return collector.getSubscriber().roots(); - } - } - - protected Subscriber getSubscriber() { - return collector.getSubscriber(); - } - - public long getScheduleDelay() { - return scheduleDelay; - } - - protected void start() { - if(getState() == Job.NONE) { - if(shouldReschedule()) { - schedule(getScheduleDelay()); - } - } - } - - /** - * Specify the interval in seconds at which this job is scheduled. - * @param seconds delay specified in seconds - */ - public void setRefreshInterval(long seconds) { - boolean restart = false; - if(getState() == Job.SLEEPING) { - restart = true; - cancel(); - } - scheduleDelay = seconds * 1000; - if(restart) { - start(); - } - } - - /** - * Returns the interval of this job in seconds. - * @return - */ - public long getRefreshInterval() { - return scheduleDelay / 1000; - } - - public void setRestartOnCancel(boolean restartOnCancel) { - this.restartOnCancel = restartOnCancel; - } - - public void setReschedule(boolean reschedule) { - this.reschedule = reschedule; - } - - public boolean shouldReschedule() { - return reschedule; - } - - public static void addRefreshListener(IRefreshSubscriberListener listener) { - synchronized(listeners) { - if(! listeners.contains(listener)) { - listeners.add(listener); - } - } - } - - public static void removeRefreshListener(IRefreshSubscriberListener listener) { - synchronized(listeners) { - listeners.remove(listener); - } - } - - protected void notifyListeners(final boolean started, final IRefreshEvent event) { - // Get a snapshot of the listeners so the list doesn't change while we're firing - IRefreshSubscriberListener[] listenerArray; - synchronized (listeners) { - listenerArray = (IRefreshSubscriberListener[]) listeners.toArray(new IRefreshSubscriberListener[listeners.size()]); - } - // Notify each listener in a safe manner (i.e. so their exceptions don't kill us) - for (int i = 0; i < listenerArray.length; i++) { - IRefreshSubscriberListener listener = listenerArray[i]; - Notification notification = new Notification() { - protected void notify(IRefreshSubscriberListener listener) { - if(started) { - listener.refreshStarted(event); - } else { - listener.refreshDone(event); - } - } - }; - notification.run(listener); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshUserNotificationPolicy.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshUserNotificationPolicy.java deleted file mode 100644 index 1c7fa1542..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshUserNotificationPolicy.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.eclipse.team.internal.ui.jobs; - -import java.util.*; - -import org.eclipse.compare.CompareUI; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.*; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.synchronize.SyncInfo; -import org.eclipse.team.internal.ui.*; -import org.eclipse.team.internal.ui.synchronize.RefreshCompleteDialog; -import org.eclipse.team.ui.TeamUI; -import org.eclipse.team.ui.synchronize.subscriber.*; -import org.eclipse.team.ui.synchronize.viewers.SyncInfoCompareInput; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.progress.UIJob; - -/** - * This class manages the notification and setup that occurs after a refresh is completed. - * - * - */ -public class RefreshUserNotificationPolicy implements IRefreshSubscriberListener { - - private SubscriberParticipant participant; - - public RefreshUserNotificationPolicy(SubscriberParticipant participant) { - this.participant = participant; - } - - /* - * (non-Javadoc) - * @see org.eclipse.team.internal.ui.jobs.IRefreshSubscriberListener#refreshStarted(org.eclipse.team.internal.ui.jobs.IRefreshEvent) - */ - public void refreshStarted(IRefreshEvent event) { - } - - /* - * (non-Javadoc) - * @see org.eclipse.team.internal.ui.jobs.IRefreshSubscriberListener#refreshDone(org.eclipse.team.internal.ui.jobs.IRefreshEvent) - */ - public void refreshDone(final IRefreshEvent event) { - // Ensure that this event was generated for this participant - if (event.getSubscriber() != participant.getSubscriberSyncInfoCollector().getSubscriber()) - return; - - // Decide on what action to take after the refresh is completed - TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() { - public void run() { - boolean prompt = TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCHRONIZING_COMPLETE_SHOW_DIALOG); - - SyncInfo[] infos = event.getChanges(); - List selectedResources = new ArrayList(); - selectedResources.addAll(Arrays.asList(event.getResources())); - for (int i = 0; i < infos.length; i++) { - selectedResources.add(infos[i].getLocal()); - } - IResource[] resources = (IResource[]) selectedResources.toArray(new IResource[selectedResources.size()]); - - // If it's a file, simply show the compare editor - if (resources.length == 1 && resources[0].getType() == IResource.FILE) { - IResource file = resources[0]; - SyncInfo info = participant.getSubscriberSyncInfoCollector().getSubscriberSyncInfoSet().getSyncInfo(file); - if(info != null) { - CompareUI.openCompareEditor(new SyncInfoCompareInput(participant.getName(), info)); - prompt = false; - } - } - - // ensure the synchronize views are shown - TeamUI.getSynchronizeManager().showSynchronizeViewInActivePage(); - - - // Prompt user if preferences are set for this type of refresh. - if (prompt) { - notifyIfNeededModal(event); - } - } - }); - RefreshSubscriberJob.removeRefreshListener(this); - } - - private void notifyIfNeededModal(final IRefreshEvent event) { - TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() { - public void run() { - RefreshCompleteDialog d = new RefreshCompleteDialog(new Shell(TeamUIPlugin.getStandardDisplay()), event, participant); - d.setBlockOnOpen(false); - d.open(); - } - }); - } - - private void notifyIfNeededNonModal(final IRefreshEvent event) { - String message = Policy.bind("RefreshUserNotificationPolicy.0", event.getSubscriber().getName()); //$NON-NLS-1$ - PlatformUI.getWorkbench().getProgressService().requestInUI(new UIJob(message) { - public IStatus runInUIThread(IProgressMonitor monitor) { - RefreshCompleteDialog d = new RefreshCompleteDialog(new Shell(TeamUIPlugin.getStandardDisplay()), event, participant); - d.setBlockOnOpen(false); - d.open(); - return Status.OK_STATUS; - } - }, message); - } - - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties deleted file mode 100644 index d70efa8ab..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties +++ /dev/null @@ -1,393 +0,0 @@ -############################################################################### -# Copyright (c) 2000, 2003 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Common Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/cpl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -############################################### -# Message catalog for org.eclipse.team.ui -############################################### - -CatchupReleaseViewer.open=&Show Content Comparison -CatchupReleaseViewer.expand=&Expand All -CatchupReleaseViewer.ignoreWhiteSpace=&Ignore White Space -CatchupReleaseViewer.refreshAction=&Refresh With Remote -CatchupReleaseViewer.showIncomingAction=Toggle showing of incoming Changes -CatchupReleaseViewer.showInNavigator=Show in &Navigator -CatchupReleaseViewer.showOnlyConflictsAction=Toggle showing of conflicting -CatchupReleaseViewer.showOutgoingAction=Toggle showing of outgoing Changes -CatchupReleaseViewer.removeFromView=Remove &From View -CatchupReleaseViewer.copyAllRightToLeft=Copy &All Changes From Right To Left -CatchupReleaseViewer.Compare_File_Contents_1=Compare File Contents -CatchupReleaseViewer.Copying_right_contents_into_workspace_2=Copying right contents into workspace -CatchupReleaseViewer.MakingLocalLikeRemote=Processing {0} - -ConfigureProjectAction.configureProject=Configure Project -ConfigureProjectWizard.configureProject=Share Project -ConfigureProjectWizard.description=Select the repository plug-in that will be used to share the selected project. -ConfigureProjectWizard.title=Share Project -ConfigureProjectWizardMainPage.selectRepository=Select a repository type: -ConfigureProjectWizardMainPage.selectTarget=Select a site type: - -ConfigurationWizard.exceptionCreatingWizard=Exception creating wizard. - -DeconfigureProjectAction.deconfigureProject=Deconfigure Project - -IgnorePreferencePage.description=Use this page to specify a list of resource name patterns to exclude from version control. -IgnorePreferencePage.add=&Add... -IgnorePreferencePage.enterPatternLong=Please enter a pattern: -IgnorePreferencePage.enterPatternShort=Enter Ignore Pattern -IgnorePreferencePage.ignorePatterns=&Ignore Patterns: -IgnorePreferencePage.patternExistsLong=The entered pattern already exists. -IgnorePreferencePage.patternExistsShort=Pattern Already Exists -IgnorePreferencePage.remove=&Remove - -MergeResource.commonFile=Common file: {0} -MergeResource.noCommonFile=No common file -MergeResource.noRepositoryFile=No remote file -MergeResource.repositoryFile=Remote file: {0} -MergeResource.workspaceFile=Workspace file: {0} - -nothingToSynchronize=Nothing to Synchronize -simpleInternal=Internal error -exception=An exception occurred - -SyncCompareInput.nothingText=Workspace resources are the same as remote. -SyncCompareInput.refresh=Error During Refresh with Remote -SyncCompareInput.synchronize=Synchronize -SyncCompareInput.taskTitle=Synchronizing with Remote... - -SyncSet.conflicts={0} conflicts, -SyncSet.incomings={0} incoming change(s), -SyncSet.noConflicts=No conflicts, -SyncSet.noIncomings=no incoming changes, -SyncSet.noOutgoings=no outgoing changes. -SyncSet.outgoings={0} outgoing change(s). - -SyncView.freeModeAction=Incoming/Outgoing Mode -SyncView.freeModeTitle=Synchronize - Incoming/Outgoing Mode -SyncView.freeModeToolTip=Incoming/Outgoing Mode -SyncView.incomingModeAction=Incoming Mode -SyncView.incomingModeTitle=Synchronize - Incoming Mode -SyncView.incomingModeToolTip=Incoming Mode -SyncView.outgoingModeAction=Outgoing Mode -SyncView.outgoingModeTitle=Synchronize - Outgoing Mode -SyncView.outgoingModeToolTip=Outgoing Mode -SyncView.same=Workspace resources are the same as remote. -SyncView.text=Synchronize resources with their remote to display them here. -SyncView.unableSynchronize=Unable to Synchronize -SyncView.saveTitle=Save Resource -SyncView.saveMessage=Resource has been modified. Save changes? -SyncView.errorSaving=Error while saving modified resources -SyncView.cantSaveError=Can't save changes: {0} -SyncView.dirtyIndicatorInTitle=*{0} - -LiveSyncView.titleTooltip=Working Set: {0} -LiveSyncView.title=Synchronize -LiveSyncView.titleSubscriber=Synchronize - {0} - -SyncInfoCompareInput.localLabel=Local File -SyncInfoCompareInput.localLabelExists=Local File ({0}) -SyncInfoCompareInput.remoteLabel=Remote File -SyncInfoCompareInput.baseLabel=Common Ancestor -SyncInfoCompareInput.remoteLabelExists=Remote File ({0}) -SyncInfoCompareInput.baseLabelExists=Common Ancestor ({0}) -SyncInfoCompareInput.title={0} -SyncInfoCompareInput.tooltip={0}: {1} - -TeamAction.internal=Internal error occurred. -TeamFile.saveChanges=Unable to save changes to file: {0} -TeamFile.modified={0}* - -TextPreferencePage.add=&Add... -TextPreferencePage.binary=Binary -TextPreferencePage.change=&Change -TextPreferencePage.contents=Contents -TextPreferencePage.description=&File extensions with known content: -TextPreferencePage.enterExtensionLong=Please enter a file extension: -TextPreferencePage.enterExtensionShort=Enter File Extension -TextPreferencePage.extension=Extension -TextPreferencePage.extensionExistsLong=The entered extension already exists. -TextPreferencePage.extensionExistsShort=Extension Already Exists -TextPreferencePage.remove=&Remove -TextPreferencePage.text=ASCII - -TextPreferencePage.columnExtension=extension -TextPreferencePage.columnContents=contents - -SynchronizationViewPreference.defaultPerspectiveNone=None -SynchronizationViewPreference.defaultPerspectiveDescription=This setting controls which perspective to activate when resources are synchronized.\nTo indicate that a perspective switch should not occur select ''None''. -SynchronizationViewPreference.defaultPerspectiveLabel=Perspective: - -ScheduledSyncViewRefresh.taskName=Refreshing synchronize view partners with remote -SyncViewRefresh.taskName=Refreshing ''{0}'' - -ExportProjectSetMainPage.Select_the_projects_to_include_in_the_project_set__2=&Select the projects to include in the Team Project Set: -ExportProjectSetMainPage.Project_Set_File_Name__3=Select the export destination: -ExportProjectSetMainPage.Browse_4=B&rowse... -ExportProjectSetMainPage.You_have_specified_a_folder_5=You have specified a folder - -ImportProjectSetMainPage.Project_Set_File_Name__2=F&ile name: -ImportProjectSetMainPage.Browse_3=B&rowse... -ImportProjectSetMainPage.The_specified_file_does_not_exist_4=The specified file does not exist -ImportProjectSetMainPage.You_have_specified_a_folder_5=You have specified a folder -ImportProjectSetMainPage.workingSetNameEmpty=The working set name must not be empty -ImportProjectSetMainPage.workingSetNameExists=The specified working set already exists -ImportProjectSetMainPage.createWorkingSetLabel=&Create a working set containing the imported projects -ImportProjectSetMainPage.workingSetLabel=&Working Set Name: - -ProjectSetContentHandler.Element_provider_must_be_contained_in_element_psf_4=Element provider must be contained in element psf -ProjectSetContentHandler.Element_project_must_be_contained_in_element_provider_7=Element project must be contained in element provider - -ProjectSetExportWizard.Project_Set_1=Team Project Set -ProjectSetExportWizard.Export_a_Project_Set_3=Export a Team Project Set -ProjectSetExportWizard.Question_4=Question -ProjectSetExportWizard.Target_directory_does_not_exist._Would_you_like_to_create_it__5=Target directory does not exist. Would you like to create it? -ProjectSetExportWizard.Export_Problems_6=Export Problems -ProjectSetExportWizard.An_error_occurred_creating_the_target_directory_7=An error occurred creating the target directory -ProjectSetExportWizard.Question_8=Question -ProjectSetExportWizard.Target_already_exists._Would_you_like_to_overwrite_it__9=Target already exists. Would you like to overwrite it? -ProjectSetImportWizard.Project_Set_1=Team Project Set -ProjectSetImportWizard.Import_a_Project_Set_3=Import a Team Project Set -ProjectSetImportWizard.workingSetExistsTitle=Working Set Exists -ProjectSetImportWizard.workingSetExistsMessage=Working set ''{0}'' already exists. Overwrite? - -ExportProjectSetMainPage.Project_Set_Files_3=Team Project Set Files (*.psf) -ExportProjectSetMainPage.default=projectSet.psf -ImportProjectSetMainPage.allFiles=All Files (*.*) -ImportProjectSetMainPage.Project_Set_Files_2=Team Project Set Files (*.psf) -ExportProjectSetMainPage.&File_name__1=&File name: -TeamPreferencePage.General_settings_for_Team_support_1=General settings for Team support -TeamPreferencePage.&Use_Incoming/Outgoing_mode_when_synchronizing_2=&Use Incoming/Outgoing mode when synchronizing - -SynchronizeView.noSubscribersMessage=Synchronize resources with their remote to display them here. Some Team plugins may also show resources here automatically when their plugin is activated. - -SyncViewerDirectionFilters.incomingTitle=Incoming -SyncViewerDirectionFilters.incomingToolTip=Toggle showing of incoming changes -SyncViewerDirectionFilters.outgoingTitle=Outgoing -SyncViewerDirectionFilters.outgoingToolTip=Toggle showing of outgoing changes -SyncViewerDirectionFilters.conflictingTitle=Conflicting -SyncViewerDirectionFilters.conflictingToolTip=Toggle showing of conflicting changes - -SyncViewPreferencePage.lastRefreshRun=The last background refresh was run at: {0} -SyncViewPreferencePage.lastRefreshRunNever=Never - -############################################### -# Sync view actions -############################################### - -action.toggleViewFlat.label=Flat -action.toggleViewFlat.image=flatLayout.gif - -action.toggleViewHierarchical.label=Hierarchical -action.toggleViewHierarchical.image=hierarchicalLayout.gif - -action.workingSets.label=Working Sets -action.workingSets.none=Working Sets -action.workingSets.tooltip=Working Sets -action.workingSets.description=Working Sets -action.workingSets.image=workingsets.gif - -action.collapseAll.label=Collapse All -action.collapseAll.tooltip=Collapse All -action.collapseAll.description=Collapse All -action.collapseAll.image=collapseall.gif - -action.configureSchedulel.label=Schedule... -action.configureSchedulel.tooltip=Configure the Refresh Schedule... - -action.changeFilters.label=Filters... -action.changeFilters.tooltip=Select change filters -action.changeFilters.description=Select which change filters to apply in Synchronize view -action.changeFilters.image=filter_change.gif - -action.refreshWithRemote.label=&Refresh with remote -action.refreshWithRemote.tooltip=Refresh with remote -action.refreshWithRemote.description=Refresh with remote -action.refreshWithRemote.image=refresh.gif - -action.directionFilterIncoming.label=Incoming -action.directionFilterIncoming.tooltip=Incoming Mode -action.directionFilterIncoming.description=Incoming Mode (shows incoming changes and conflicts) -action.directionFilterIncoming.image=catchup_rls.gif - -action.directionFilterOutgoing.label=Outgoing -action.directionFilterOutgoing.tooltip=Outgoing Mode -action.directionFilterOutgoing.description=Outgoing Mode (shows outgoing changes and conflicts) -action.directionFilterOutgoing.image=release_rls.gif - -action.directionFilterConflicts.label=Conflicts -action.directionFilterConflicts.tooltip=Conflicts Mode -action.directionFilterConflicts.description=Conflicts Mode (shows conflicts) -action.directionFilterConflicts.image=conflict_synch.gif - -action.directionFilterBoth.label=Both -action.directionFilterBoth.tooltip=Incoming/Outgoing mode -action.directionFilterBoth.description=Incoming/Outgoing mode (shows outgoing changes, incoming changes, and conflicts) -action.directionFilterBoth.image=catchuprelease_rls.gif - -action.refreshSubscriber.label=Registered Synchronize Partners -action.refreshSubscriber.tooltip=Registered Synchronize Partners -action.refreshSubscriber.description=Registered Synchronize Partners -action.refreshSubscriber.image=contents.gif - -action.comparisonCriteria.label=Comparison Criteria -action.comparisonCriteria.tooltip=Select the comparison method -action.comparisonCriteria.description=Select the comparison method -action.comparisonCriteria.image=showsync_rn.gif - -action.navigateNext.label=Go to Next Difference -action.navigateNext.tooltip=Go to Next Difference -action.navigateNext.description=Go to Next Difference -action.navigateNext.image=next_nav.gif - -action.navigatePrevious.label=Go to Previous Difference -action.navigatePrevious.tooltip=Go to Previous Difference -action.navigatePrevious.description=Go to Next Difference -action.navigatePrevious.image=prev_nav.gif - -action.removePage.label=Remove -action.removePage.tooltip=Remove -action.removePage.description=Remove -action.removePage.image=rem_co.gif - -action.expandAll.label=E&xpand All -action.open.label=&Open -action.openInCompareEditor.label=Open In Compare Editor -action.cancelSubscriber.label=Cancel - -action.syncViewPreferences.label=Preferences... -action.refreshViewContents.label=Refresh View Contents -action.changeFilterShowAdditions.label=Show Additions -action.changeFilterShowDeletions.label=Show Deletions -action.changeFilterShowChanges.label=Show Changes -action.layout.label=Layout - -############################################### -# Misc -############################################### - -SynchronizeView.12=One item selected -SynchronizeView.13=\ items selected -SynchronizeView.14=Error opening perspective -SynchronizeView.16=Error opening view - -StatisticsPanel.outgoing=Outgoing: -StatisticsPanel.incoming=Incoming: -StatisticsPanel.conflicting=Conflicting: -StatisticsPanel.changeNumbers={0}/{1} -StatisticsPanel.outgoing=Outgoing -StatisticsPanel.conflicting=Conflicting -StatisticsPanel.incoming=Incoming -StatisticsPanel.noWorkingSet=<No Working Set> -StatisticsPanel.workingSetTooltip=Double-click to change the working set applied to the Synchronize View. -StatisticsPanel.numbersTooltip=The number of ''{0}'' changes in the entire workspace. -StatisticsPanel.numbersWorkingSetTooltip=The number of ''{0}'' changes in working set ''{1}'' versus those in the entire workspace. -StatisticsPanel.numberTotal={0} changes - -SyncViewerPreferencePage.6=General Synchronize Settings -SyncViewerPreferencePage.7=General Team Settings: -SyncViewerPreferencePage.8=Display -SyncViewerPreferencePage.9=Compress in-sync folder paths when using the tree view -SyncViewerPreferencePage.10=Use incoming/outgoing mode when synchronizing -SyncViewerPreferencePage.11=Refreshing with Remote -SyncViewerPreferencePage.15=Perspective Switching - -RefreshSubscriberInputJob.1=Synchronizing ''{0}'' with remote: {1} resources -RefreshSubscriberJob.1=Team refresh {0} folders for {1} -RefreshSubscriberJob.0=An error occured while synchronizing with remote contents. - -CopyAction.title=&Copy -CopyAction.toolTip=Copy -CopyAction.errorTitle=Problem Copying to Clipboard -CopyAction.errorMessage=There was a problem when accessing the system clipboard. Retry? -PasteAction.title=&Paste -PasteAction.toolTip=Paste -RefactorActionGroup.0=Edi&t -SynchronizeManager.7=Error notifying of added/removal of synchronize participants -SynchronizeManager.8=Error initializing participants -SynchronizeManager.9=Synchronize participant with id {0} is not in the registry -SynchronizeManager.10=Error saving synchronize participants -SynchronizeView.1=Synchronize -SynchronizeView.2=Synchronize ({0}) -SyncViewerPreferencePage.19=Show all synchronization information in a resource\'s text label -TeamSubscriberParticipantPage.7=Resource -TeamSubscriberParticipantPage.8=In Folder -TeamSubscriberSyncPage.labelWithSyncKind={0} {1} -AbstractSynchronizeParticipant.4=Cannot initialize participant. Wrong descriptor type - -SynchronizeManager.11=Error creating participant instance -AbstractSynchronizeParticipant.5=Exception notifying participant listeners of changes. -SynchronizeManager.13=Error initializing synchronize participant -SyncViewerPreferencePage.16=Prompt at the end of a refresh even when no changes are found. -SyncViewerPreferencePage.17=Prompt at the end of a refresh if changes are found. -SyncViewerPreferencePage.30=Prompting -SyncViewerPreferencePage.31=Prompt at the end of a scheduled refresh even when no changes are found -SyncViewerPreferencePage.32=Prompt at the end of a scheduled refresh when changes are found - -ChangesSection.filterHides=The current ''{0}'' mode is empty. -ChangesSection.filterHidesSingular=However there is {0} change in the ''{1}'' mode. -ChangesSection.filterHidesPlural=However there are {0} changes in the ''{1}'' mode. -ChangesSection.filterChange=Change to ''{0}'' mode. -ChangesSection.workingSetHiding=The current working set ''{0}'' is hiding changes in your workspace. -ChangesSection.workingSetRemove=Remove working set. -ChangesSection.noChanges=No changes in ''{0}''. -Utils.22=Incoming -Utils.23=Outgoing -Utils.24=Incoming/Outgoing -Utils.25=Conflicting -Utils.26=unknown mode -RefreshCompleteDialog.4=Team Resfresh Complete - {0} -RefreshCompleteDialog.5=Synchronize has completed and you have changes to synchronize. {0} currently has {1} outgoing, {2} incoming, and {3} conflicting changes. -RefreshCompleteDialog.6=No changes to synchronize. -RefreshCompleteDialog.17=Details >> -RefreshCompleteDialog.18=<< Details -RefreshUserNotificationPolicy.0=Synchronize of ''{0}'' Complete. -ConfigureRefreshScheduleDialog.0=Configure Synchronize Schedule - {0} -ConfigureRefreshScheduleDialog.1=You can allow ''{0}'' to periodically refresh it's synchronization state in the background. -ConfigureRefreshScheduleDialog.1a=The last refresh occured at: {0} -ConfigureRefreshScheduleDialog.2=Don't schedule the refresh operation to run periodically. -ConfigureRefreshScheduleDialog.3=Using the following schedule: -ConfigureRefreshScheduleDialog.4=Every: -ConfigureRefreshScheduleDialog.5=hour(s) -ConfigureRefreshScheduleDialog.6=minutes(s) -ConfigureRefreshScheduleDialog.7=Number must be a positive number greater than 0 -ConfigureRefreshScheduleDialog.8=Number must be a positive number greater than 0 -RefreshSchedule.6=\ ({0} changes found) -RefreshSchedule.7=\ (No changes found) -RefreshSchedule.8=Not Scheduled -RefreshSchedule.9=hours -RefreshSchedule.10=minutes -RefreshSchedule.11=hour -RefreshSchedule.12=minute -RefreshSchedule.13=Every {0} {1} -RefreshSchedule.14=Scheduled refresh of ''{0}'' -DiffNodeControllerHierarchical.0=Updating labels -ChangesSection.8=Show Errors -ChangesSection.9=Reset View -ChangesSection.10=Errors have occurred calculating the synchronization state for {0} -ChangesSection.11=Errors Populating View -ChangesSection.12=Multiple errors occurred while attempting to populate the view. - -OpenComparedDialog.diffViewTitleMany=Changes -OpenComparedDialog.diffViewTitleOne=Changes -OpenComparedDialog.noChangeTitle=Operation Complete -OpenComparedDialog.noChangesMessage=No Changes Found. -GlobalRefreshAction.4=Synchronize... -GlobalRefreshAction.5=Synchronize {0}... -SubscriberRefreshWizard.0=Synchronize -ParticipantCompareDialog.1=Remember this result by placing it in the Synchronize View. -ParticipantCompareDialog.2=Confirm Save -ParticipantCompareDialog.3=Do you want to save changes? -RefreshCompleteDialog.21=Show only the latest new incoming changes -RefreshCompleteDialog.22=Don't show this dialog again. -SynchronizeManager.27=Confirm Perspective Switch -SynchronizeManager.28=Never -SynchronizeManager.29=Always -SynchronizeManager.30=Synchronization is associated with the {0} perspective. Do you want to switch to that perspective now? -RefreshCompleteDialog.9=Changes -RefreshSubscriberJob.2=Synchronizing {0} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/ComboFieldEditor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/ComboFieldEditor.java deleted file mode 100644 index a64177bcc..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/ComboFieldEditor.java +++ /dev/null @@ -1,185 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.preferences; - -import org.eclipse.jface.preference.FieldEditor; -import org.eclipse.jface.util.Assert; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** - * A field editor for a combo box that allows the drop-down selection of one of a list of items. - * - * XXX: Note this is a copy from org.eclipse.debug.internal.ui.preferences - * This class can be removed once bug 24928 is fixed. - * - * @since 2.1 - */ -public class ComboFieldEditor extends FieldEditor { - - /** - * The <code>Combo</code> widget. - */ - private Combo fCombo; - - /** - * The value (not the name) of the currently selected item in the Combo widget. - */ - private String fValue; - - /** - * The names (labels) and underlying values to populate the combo widget. These should be - * arranged as: { {name1, value1}, {name2, value2}, ...} - */ - private String[][] fEntryNamesAndValues; - - public ComboFieldEditor(String name, String labelText, String[][] entryNamesAndValues, Composite parent) { - init(name, labelText); - Assert.isTrue(checkArray(entryNamesAndValues)); - fEntryNamesAndValues= entryNamesAndValues; - createControl(parent); - } - - /** - * Checks whether given <code>String[][]</code> is of "type" - * <code>String[][2]</code>. - * - * @return <code>true</code> if it is ok, and <code>false</code> otherwise - */ - private boolean checkArray(String[][] table) { - if (table == null) { - return false; - } - for (int i= 0; i < table.length; i++) { - String[] array= table[i]; - if (array == null || array.length != 2) { - return false; - } - } - return true; - } - - /* - * @see FieldEditor#adjustForNumColumns(int) - */ - protected void adjustForNumColumns(int numColumns) { - Control control= getLabelControl(); - if (control != null) { - ((GridData)control.getLayoutData()).horizontalSpan= numColumns; - } - ((GridData)fCombo.getLayoutData()).horizontalSpan= numColumns; - } - - /* - * @see FieldEditor#doFillIntoGrid(Composite, int) - */ - protected void doFillIntoGrid(Composite parent, int numColumns) { - Control control= getLabelControl(parent); - GridData gd= new GridData(); - gd.horizontalSpan= numColumns; - control.setLayoutData(gd); - control= getComboBoxControl(parent); - gd= new GridData(); - gd.horizontalSpan= numColumns; - control.setLayoutData(gd); - } - - /* - * @see FieldEditor#doLoad() - */ - protected void doLoad() { - updateComboForValue(getPreferenceStore().getString(getPreferenceName())); - } - - /* - * @see FieldEditor#doLoadDefault() - */ - protected void doLoadDefault() { - updateComboForValue(getPreferenceStore().getDefaultString(getPreferenceName())); - } - - /* - * @see FieldEditor#doStore() - */ - protected void doStore() { - if (fValue == null) { - getPreferenceStore().setToDefault(getPreferenceName()); - return; - } - - getPreferenceStore().setValue(getPreferenceName(), fValue); - } - - /* - * @see FieldEditor#getNumberOfControls() - */ - public int getNumberOfControls() { - return 1; - } - - /** - * Lazily create and return the Combo control. - */ - public Combo getComboBoxControl(Composite parent) { - if (fCombo == null) { - fCombo= new Combo(parent, SWT.READ_ONLY); - for (int i= 0; i < fEntryNamesAndValues.length; i++) { - fCombo.add(fEntryNamesAndValues[i][0], i); - } - fCombo.setFont(parent.getFont()); - fCombo.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - String oldValue= fValue; - String name= fCombo.getText(); - fValue= getValueForName(name); - setPresentsDefaultValue(false); - fireValueChanged(VALUE, oldValue, fValue); - } - }); - } - return fCombo; - } - - /** - * Given the name (label) of an entry, return the corresponding value. - */ - protected String getValueForName(String name) { - for (int i= 0; i < fEntryNamesAndValues.length; i++) { - String[] entry= fEntryNamesAndValues[i]; - if (name.equals(entry[0])) { - return entry[1]; - } - } - return fEntryNamesAndValues[0][0]; - } - - /** - * Set the name in the combo widget to match the specified value. - */ - protected void updateComboForValue(String value) { - fValue= value; - for (int i= 0; i < fEntryNamesAndValues.length; i++) { - if (value.equals(fEntryNamesAndValues[i][1])) { - fCombo.setText(fEntryNamesAndValues[i][0]); - return; - } - } - if (fEntryNamesAndValues.length > 0) { - fValue= fEntryNamesAndValues[0][1]; - fCombo.setText(fEntryNamesAndValues[0][0]); - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/IgnorePreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/IgnorePreferencePage.java deleted file mode 100644 index 4374a8fa0..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/IgnorePreferencePage.java +++ /dev/null @@ -1,183 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.preferences; - - -import org.eclipse.jface.dialogs.*; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.*; -import org.eclipse.team.core.IIgnoreInfo; -import org.eclipse.team.core.Team; -import org.eclipse.team.internal.ui.*; -import org.eclipse.team.ui.TeamUI; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.help.WorkbenchHelp; -public class IgnorePreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - private Table ignoreTable; - private Button addButton; - private Button removeButton; - public void init(IWorkbench workbench) { - setDescription(Policy.bind("IgnorePreferencePage.description")); //$NON-NLS-1$ - } - - /** - * Creates preference page controls on demand. - * - * @param parent the parent for the preference page - */ - protected Control createContents(Composite ancestor) { - - Composite parent = new Composite(ancestor, SWT.NULL); - GridLayout layout = new GridLayout(); - layout.marginWidth = 0; - layout.marginHeight = 0; - layout.numColumns = 2; - parent.setLayout(layout); - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - parent.setLayoutData(data); - - // set F1 help - WorkbenchHelp.setHelp(parent, IHelpContextIds.IGNORE_PREFERENCE_PAGE); - - Label l1 = new Label(parent, SWT.NULL); - l1.setText(Policy.bind("IgnorePreferencePage.ignorePatterns")); //$NON-NLS-1$ - data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); - data.horizontalSpan = 2; - l1.setLayoutData(data); - - ignoreTable = new Table(parent, SWT.CHECK | SWT.BORDER); - GridData gd = new GridData(GridData.FILL_BOTH); - //gd.widthHint = convertWidthInCharsToPixels(30); - gd.heightHint = 300; - ignoreTable.setLayoutData(gd); - ignoreTable.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - handleSelection(); - } - }); - - Composite buttons = new Composite(parent, SWT.NULL); - buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - buttons.setLayout(layout); - - addButton = new Button(buttons, SWT.PUSH); - addButton.setText(Policy.bind("IgnorePreferencePage.add")); //$NON-NLS-1$ - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, addButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - addButton.setLayoutData(data); - addButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - addIgnore(); - } - }); - - - removeButton = new Button(buttons, SWT.PUSH); - removeButton.setText(Policy.bind("IgnorePreferencePage.remove")); //$NON-NLS-1$ - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, removeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - removeButton.setLayoutData(data); - removeButton.setEnabled(false); - removeButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - removeIgnore(); - } - }); - fillTable(Team.getAllIgnores()); - Dialog.applyDialogFont(ancestor); - return parent; - } - /** - * Do anything necessary because the OK button has been pressed. - * - * @return whether it is okay to close the preference page - */ - public boolean performOk() { - int count = ignoreTable.getItemCount(); - String[] patterns = new String[count]; - boolean[] enabled = new boolean[count]; - TableItem[] items = ignoreTable.getItems(); - for (int i = 0; i < count; i++) { - patterns[i] = items[i].getText(); - enabled[i] = items[i].getChecked(); - } - Team.setAllIgnores(patterns, enabled); - TeamUIPlugin.broadcastPropertyChange(new PropertyChangeEvent(this, TeamUI.GLOBAL_IGNORES_CHANGED, null, null)); - return true; - } - - protected void performDefaults() { - super.performDefaults(); - ignoreTable.removeAll(); - IIgnoreInfo[] ignore = Team.getDefaultIgnores(); - fillTable(ignore); - } - - /** - * @param ignore - */ - private void fillTable(IIgnoreInfo[] ignore) { - for (int i = 0; i < ignore.length; i++) { - IIgnoreInfo info = ignore[i]; - TableItem item = new TableItem(ignoreTable, SWT.NONE); - item.setText(info.getPattern()); - item.setChecked(info.getEnabled()); - } - } - - private void addIgnore() { - InputDialog dialog = new InputDialog(getShell(), Policy.bind("IgnorePreferencePage.enterPatternShort"), Policy.bind("IgnorePreferencePage.enterPatternLong"), null, null); //$NON-NLS-1$ //$NON-NLS-2$ - dialog.open(); - if (dialog.getReturnCode() != InputDialog.OK) return; - String pattern = dialog.getValue(); - if (pattern.equals("")) return; //$NON-NLS-1$ - // Check if the item already exists - TableItem[] items = ignoreTable.getItems(); - for (int i = 0; i < items.length; i++) { - if (items[i].getText().equals(pattern)) { - MessageDialog.openWarning(getShell(), Policy.bind("IgnorePreferencePage.patternExistsShort"), Policy.bind("IgnorePreferencePage.patternExistsLong")); //$NON-NLS-1$ //$NON-NLS-2$ - return; - } - } - TableItem item = new TableItem(ignoreTable, SWT.NONE); - item.setText(pattern); - item.setChecked(true); - } - - private void removeIgnore() { - int[] selection = ignoreTable.getSelectionIndices(); - ignoreTable.remove(selection); - } - private void handleSelection() { - if (ignoreTable.getSelectionCount() > 0) { - removeButton.setEnabled(true); - } else { - removeButton.setEnabled(false); - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java deleted file mode 100644 index 2a5f1c12b..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java +++ /dev/null @@ -1,225 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.preferences; - -import java.text.Collator; -import java.text.DateFormat; -import java.util.*; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.preference.*; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.*; -import org.eclipse.team.internal.ui.*; -import org.eclipse.ui.*; - -/** - * This area provides the widgets for providing the CVS commit comment - */ -public class SyncViewerPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage, IPreferenceIds { - - private BooleanFieldEditor compressFolders = null; - private BooleanFieldEditor showSyncInLabels = null; - private BooleanFieldEditor promptAtEndOfSynchronize = null; - private BooleanFieldEditor useDefaultPerspective = null; - private RadioGroupFieldEditor synchronizePerspectiveSwitch = null; - - private static class PerspectiveDescriptorComparator implements Comparator { - /* - * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) - */ - public int compare(Object o1, Object o2) { - if (o1 instanceof IPerspectiveDescriptor && o2 instanceof IPerspectiveDescriptor) { - String id1= ((IPerspectiveDescriptor)o1).getLabel(); - String id2= ((IPerspectiveDescriptor)o2).getLabel(); - return Collator.getInstance().compare(id1, id2); - } - return 0; - } - } - - public SyncViewerPreferencePage() { - super(GRID); - setTitle(Policy.bind("SyncViewerPreferencePage.6")); //$NON-NLS-1$ - setDescription(Policy.bind("SyncViewerPreferencePage.7")); //$NON-NLS-1$ - setPreferenceStore(TeamUIPlugin.getPlugin().getPreferenceStore()); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent) { - super.createControl(parent); - //WorkbenchHelp.setHelp(getControl(), IDebugHelpContextIds.CONSOLE_PREFERENCE_PAGE); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() - */ - public void createFieldEditors() { - compressFolders = new BooleanFieldEditor(SYNCVIEW_COMPRESS_FOLDERS, Policy.bind("SyncViewerPreferencePage.9"), SWT.NONE, getFieldEditorParent()); //$NON-NLS-1$ - addField(compressFolders); - showSyncInLabels = new BooleanFieldEditor(SYNCVIEW_VIEW_SYNCINFO_IN_LABEL, Policy.bind("SyncViewerPreferencePage.19"), SWT.NONE, getFieldEditorParent()); //$NON-NLS-1$ - addField(showSyncInLabels); - - new Label(getFieldEditorParent(), SWT.NONE); - - promptAtEndOfSynchronize = new BooleanFieldEditor(SYNCHRONIZING_COMPLETE_SHOW_DIALOG, "Prompt at the end of a synchronize operation.", SWT.NONE, getFieldEditorParent()); //$NON-NLS-1$ - addField(promptAtEndOfSynchronize); - - synchronizePerspectiveSwitch= new RadioGroupFieldEditor(SYNCHRONIZING_COMPLETE_PERSPECTIVE, "Switch to the associated perspective when a synchronize operation completes", 3, - new String[][] { - {"Always", SYNCHRONIZING_COMPLETE_PERSPECTIVE_ALWAYS}, - {"Never", SYNCHRONIZING_COMPLETE_PERSPECTIVE_NEVER}, - {"Prompt", SYNCHRONIZING_COMPLETE_PERSPECTIVE_PROMPT} - }, - getFieldEditorParent(), true); - addField(synchronizePerspectiveSwitch); - - Group perspectiveGroup = createGroup(getFieldEditorParent(), Policy.bind("SyncViewerPreferencePage.15")); //$NON-NLS-1$ - - createLabel(perspectiveGroup, Policy.bind("SynchronizationViewPreference.defaultPerspectiveDescription"), 1); //$NON-NLS-1$ - - handleDeletedPerspectives(); - String[][] perspectiveNamesAndIds = getPerspectiveNamesAndIds(); - ComboFieldEditor comboEditor= new ComboFieldEditor( - SYNCVIEW_DEFAULT_PERSPECTIVE, - Policy.bind("SynchronizationViewPreference.defaultPerspectiveLabel"), //$NON-NLS-1$ - perspectiveNamesAndIds, - perspectiveGroup); - addField(comboEditor); - - Dialog.applyDialogFont(getFieldEditorParent()); - updateLayout(perspectiveGroup); - getFieldEditorParent().layout(true); - } - - private Label createLabel(Composite parent, String title, int spacer) { - GridData data; - Label l = new Label(parent, SWT.WRAP); - l.setFont(parent.getFont()); - data = new GridData(); - data.horizontalSpan = 2; - if(spacer != 0) { - data.verticalSpan = spacer; - } - data.horizontalAlignment = GridData.FILL; - l.setLayoutData(data); - if(title != null) { - l.setText(title); //$NON-NLS-1$ - } - return l; - } - - private Group createGroup(Composite parent, String title) { - Group display = new Group(parent, SWT.NONE); - updateLayout(display); - GridData data = new GridData(); - data.horizontalSpan = 2; - data.horizontalAlignment = GridData.FILL; - display.setLayoutData(data); - display.setText(title); - return display; - } - - private void updateLayout(Composite composite) { - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - layout.marginWidth = 5; - layout.marginHeight =5; - layout.horizontalSpacing = 5; - layout.verticalSpacing = 5; - composite.setLayout(layout); - } - - private void updateLastRunTime(Label label) { - String text; - long mills = 0; - if(mills == 0) { - String never = Policy.bind("SyncViewPreferencePage.lastRefreshRunNever"); //$NON-NLS-1$ - text = Policy.bind("SyncViewPreferencePage.lastRefreshRun", never); //$NON-NLS-1$ - } else { - Date lastTimeRun = new Date(mills); - String sLastTimeRun = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(lastTimeRun); - text = Policy.bind("SyncViewPreferencePage.lastRefreshRun", sLastTimeRun); //$NON-NLS-1$ - } - label.setText(text); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) - */ - public void init(IWorkbench workbench) { - } - - /* (non-Javadoc) - * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent event) { - //if(event.getSource() == bkgScheduledRefresh || event.getSource() == scheduledDelay) { - // updateEnablements(); - // } - super.propertyChange(event); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferencePage#performOk() - */ - public boolean performOk() { - TeamUIPlugin.getPlugin().savePluginPreferences(); - return super.performOk(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.FieldEditorPreferencePage#checkState() - */ - protected void initialize() { - super.initialize(); - updateEnablements(); - } - - protected void updateEnablements() { - //boolean enabled = bkgScheduledRefresh.getBooleanValue(); - //scheduledDelay.setEnabled(enabled, refreshGroup); - //scheduledDelay.refreshValidState(); - } - - /** - * Return a 2-dimensional array of perspective names and ids. - */ - private String[][] getPerspectiveNamesAndIds() { - - IPerspectiveRegistry registry= PlatformUI.getWorkbench().getPerspectiveRegistry(); - IPerspectiveDescriptor[] perspectiveDescriptors= registry.getPerspectives(); - - Arrays.sort(perspectiveDescriptors, new PerspectiveDescriptorComparator()); - - String[][] table = new String[perspectiveDescriptors.length + 1][2]; - table[0][0] = Policy.bind("SynchronizationViewPreference.defaultPerspectiveNone"); //$NON-NLS-1$; - table[0][1] = SYNCVIEW_DEFAULT_PERSPECTIVE_NONE; - for (int i = 0; i < perspectiveDescriptors.length; i++) { - table[i + 1][0] = perspectiveDescriptors[i].getLabel(); - table[i + 1][1] = perspectiveDescriptors[i].getId(); - } - return table; - } - - private static void handleDeletedPerspectives() { - IPreferenceStore store= TeamUIPlugin.getPlugin().getPreferenceStore(); - String id= store.getString(SYNCVIEW_DEFAULT_PERSPECTIVE); - if (PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(id) == null) { - store.putValue(SYNCVIEW_DEFAULT_PERSPECTIVE, SYNCVIEW_DEFAULT_PERSPECTIVE_NONE); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TeamPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TeamPreferencePage.java deleted file mode 100644 index c65178491..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TeamPreferencePage.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.preferences; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.*; -import org.eclipse.team.internal.ui.*; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.help.WorkbenchHelp; - -public class TeamPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - Button syncModeButton; - - public TeamPreferencePage() { - setDescription(Policy.bind("TeamPreferencePage.General_settings_for_Team_support_1")); //$NON-NLS-1$ - } - - /** - * @see PreferencePage#createContents(Composite) - */ - protected Control createContents(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - - // set F1 help - WorkbenchHelp.setHelp(composite, IHelpContextIds.TEAM_PREFERENCE_PAGE); - - // GridLayout - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.marginWidth = 0; - layout.marginHeight = 0; - composite.setLayout(layout); - - // GridData - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - - // Create the checkbox for sync mode - syncModeButton = createCheckBox(composite, Policy.bind("TeamPreferencePage.&Use_Incoming/Outgoing_mode_when_synchronizing_2")); //$NON-NLS-1$ - - initializeValues(); - Dialog.applyDialogFont(parent); - return composite; - } - /** - * Creates an new checkbox instance and sets the default - * layout data. - * - * @param group the composite in which to create the checkbox - * @param label the string to set into the checkbox - * @return the new checkbox - */ - private Button createCheckBox(Composite group, String label) { - Button button = new Button(group, SWT.CHECK | SWT.LEFT); - button.setText(label); - GridData data = new GridData(); - data.horizontalSpan = 1; - button.setLayoutData(data); - return button; - } - /** - * Returns preference store that belongs to the our plugin. - * This is important because we want to store - * our preferences separately from the desktop. - * - * @return the preference store for this plugin - */ - protected IPreferenceStore doGetPreferenceStore() { - return TeamUIPlugin.getPlugin().getPreferenceStore(); - } - /** - * Defaults was clicked. Restore the CVS preferences to - * their default values - */ - protected void performDefaults() { - super.performDefaults(); - IPreferenceStore store = getPreferenceStore(); - //syncModeButton.setSelection(store.getDefaultBoolean(ISharedImages.PREF_ALWAYS_IN_INCOMING_OUTGOING)); - } - /** - * OK was clicked. Store the CVS preferences. - * - * @return whether it is okay to close the preference page - */ - public boolean performOk() { - IPreferenceStore store = getPreferenceStore(); - //store.setValue(ISharedImages.PREF_ALWAYS_IN_INCOMING_OUTGOING, syncModeButton.getSelection()); - TeamUIPlugin.getPlugin().savePluginPreferences(); - return true; - } - /** - * Initializes states of the controls from the preference store. - */ - private void initializeValues() { - IPreferenceStore store = getPreferenceStore(); - //syncModeButton.setSelection(store.getBoolean(ISharedImages.PREF_ALWAYS_IN_INCOMING_OUTGOING)); - } - /** - * @see IWorkbenchPreferencePage#init(IWorkbench) - */ - public void init(IWorkbench workbench) { - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java deleted file mode 100644 index 7aca276af..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java +++ /dev/null @@ -1,375 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.preferences; - - -import java.util.*; -import java.util.List; - -import org.eclipse.jface.dialogs.*; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.viewers.*; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.TableEditor; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.*; -import org.eclipse.team.core.IFileTypeInfo; -import org.eclipse.team.core.Team; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.help.WorkbenchHelp; -/** - * This preference page displays all patterns which determine whether a resource - * is to be treated as a text file or not. The page allows the user to add or - * remove entries from this table, and change their values from Text to Binary. - */ -public class TextPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - // Some string constants for display purposes - private static final String TEXT = Policy.bind("TextPreferencePage.text"); //$NON-NLS-1$ - private static final String BINARY = Policy.bind("TextPreferencePage.binary"); //$NON-NLS-1$ - - // The input for the table viewer - private List input; - - // Widgets - private TableViewer viewer; - private Button removeButton; - private Button changeButton; - - /** - * TableEntry is a pair of strings representing an entry in the table - */ - class TableEntry { - String ext; - String value; - public TableEntry(String ext, String value) { - this.ext = ext; - this.value = value; - } - public String getExtension() { - return ext; - } - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } - } - /** - * TableLabelProvider provides labels for TableEntrys. - */ - class TableLabelProvider extends LabelProvider implements ITableLabelProvider { - public String getColumnText(Object element, int columnIndex) { - TableEntry entry = (TableEntry)element; - switch (columnIndex) { - case 0: - return entry.getExtension(); - case 1: - return entry.getValue(); - default: - return null; - } - } - public Image getColumnImage(Object element, int columnIndex) { - return null; - } - }; - - /* - * Method declared on IWorkbenchPreferencePage - */ - public void init(IWorkbench workbench) { - } - /* - * @see PreferencePage#createControl - */ - protected Control createContents(Composite ancestor) { - - Composite parent = new Composite(ancestor, SWT.NULL); - GridLayout layout = new GridLayout(); - layout.marginWidth = 0; - layout.marginHeight = 0; - layout.numColumns = 2; - parent.setLayout(layout); - - // set F1 help - WorkbenchHelp.setHelp(parent, IHelpContextIds.FILE_TYPE_PREFERENCE_PAGE); - - Label l1 = new Label(parent, SWT.NULL); - l1.setText(Policy.bind("TextPreferencePage.description")); //$NON-NLS-1$ - GridData data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); - data.horizontalSpan = 2; - l1.setLayoutData(data); - - viewer = new TableViewer(parent, SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); - Table table = viewer.getTable(); - new TableEditor(table); - table.setHeaderVisible(true); - table.setLinesVisible(true); - GridData gd = new GridData(GridData.FILL_BOTH); - gd.widthHint = convertWidthInCharsToPixels(30); - /* - * The hardcoded hint does not look elegant, but in reality - * it does not make anything bound to this 100-pixel value, - * because in any case the tree on the left is taller and - * that's what really determines the height. - */ - gd.heightHint = 100; - table.setLayoutData(gd); - table.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - handleSelection(); - } - }); - // Create the table columns - new TableColumn(table, SWT.NULL); - new TableColumn(table, SWT.NULL); - TableColumn[] columns = table.getColumns(); - columns[0].setText(Policy.bind("TextPreferencePage.extension")); //$NON-NLS-1$ - columns[1].setText(Policy.bind("TextPreferencePage.contents")); //$NON-NLS-1$ - - CellEditor editor = new ComboBoxCellEditor(table, new String[] {TEXT, BINARY}); - viewer.setCellEditors(new CellEditor[] {null, editor}); - viewer.setColumnProperties(new String[] {"extension", "contents"}); //$NON-NLS-1$ //$NON-NLS-2$ - viewer.setCellModifier(new ICellModifier() { - public Object getValue(Object element, String property) { - String value = ((TableEntry)element).getValue(); - if (value.equals(TEXT)) { - return new Integer(0); - } else { - return new Integer(1); - } - } - public boolean canModify(Object element, String property) { - return true; - } - public void modify(Object element, String property, Object value) { - IStructuredSelection selection = (IStructuredSelection)viewer.getSelection(); - TableEntry entry = (TableEntry)selection.getFirstElement(); - if (((Integer)value).intValue() == 0) { - entry.setValue(TEXT); - } else { - entry.setValue(BINARY); - } - viewer.refresh(entry); - } - }); - viewer.setLabelProvider(new TableLabelProvider()); - viewer.setContentProvider(new IStructuredContentProvider() { - public void dispose() { - } - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - public Object[] getElements(Object inputElement) { - if (inputElement == null) return null; - return ((List)inputElement).toArray(); - } - }); - viewer.addDoubleClickListener(new IDoubleClickListener() { - public void doubleClick(DoubleClickEvent event) { - ISelection selection = event.getSelection(); - if (selection == null || !(selection instanceof IStructuredSelection)) { - return; - } - viewer.editElement(((IStructuredSelection)selection).getFirstElement(), 1); - } - }); - viewer.setSorter(new ViewerSorter() { - public int compare(Viewer viewer, Object e1, Object e2) { - TableEntry entry1 = (TableEntry)e1; - TableEntry entry2 = (TableEntry)e2; - return super.compare(viewer, entry1.getExtension(), entry2.getExtension()); - } - }); - TableLayout tl = new TableLayout(); - tl.addColumnData(new ColumnWeightData(50)); - tl.addColumnData(new ColumnWeightData(50)); - table.setLayout(tl); - - Composite buttons = new Composite(parent, SWT.NULL); - buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - buttons.setLayout(layout); - - Button addButton = new Button(buttons, SWT.PUSH); - addButton.setText(Policy.bind("TextPreferencePage.add")); //$NON-NLS-1$ - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, addButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - addButton.setLayoutData(data); - addButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - addPattern(); - } - }); - - removeButton= new Button(buttons, SWT.PUSH); - removeButton.setText(Policy.bind("TextPreferencePage.remove")); //$NON-NLS-1$ - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, removeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - removeButton.setLayoutData(data); - removeButton.setEnabled(false); - removeButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - removePattern(); - } - }); - - changeButton = new Button(buttons, SWT.PUSH); - changeButton.setText(Policy.bind("TextPreferencePage.change")); //$NON-NLS-1$ - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, changeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - changeButton.setLayoutData(data); - changeButton.setEnabled(false); - changeButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - changePattern(); - } - }); - fillTable(Team.getAllTypes()); - Dialog.applyDialogFont(parent); - return parent; - } - - protected void performDefaults() { - super.performDefaults(); - IFileTypeInfo[] infos = Team.getDefaultTypes(); - fillTable(infos); - } - - /** - * Do anything necessary because the OK button has been pressed. - * - * @return whether it is okay to close the preference page - */ - public boolean performOk() { - int size = input.size(); - String[] extensions = new String[size]; - int[] types = new int[size]; - int i = 0; - - Iterator it = input.iterator(); - while (it.hasNext()) { - TableEntry entry = (TableEntry)it.next(); - String value = entry.getValue(); - if (value.equals(TEXT)) { - types[i] = Team.TEXT; - } else { - types[i] = Team.BINARY; - } - extensions[i] = entry.getExtension(); - i++; - } - Team.setAllTypes(extensions, types); - return true; - } - /** - * Fill the table with the values from the file type registry - */ - private void fillTable(IFileTypeInfo[] infos) { - this.input = new ArrayList(); - for (int i = 0; i < infos.length; i++) { - IFileTypeInfo info = infos[i]; - int type = info.getType(); - switch (type) { - case Team.TEXT: - input.add(new TableEntry(info.getExtension(), TEXT)); - break; - case Team.BINARY: - input.add(new TableEntry(info.getExtension(), BINARY)); - break; - } - } - viewer.setInput(input); - } - /** - * Add a new item to the table with the default type of Text. - */ - private void addPattern() { - InputDialog dialog = new InputDialog(getShell(), Policy.bind("TextPreferencePage.enterExtensionShort"), Policy.bind("TextPreferencePage.enterExtensionLong"), null, null); //$NON-NLS-1$ //$NON-NLS-2$ - dialog.open(); - if (dialog.getReturnCode() != InputDialog.OK) return; - String pattern = dialog.getValue(); - if (pattern.equals("")) return; //$NON-NLS-1$ - // Check if the item already exists - Iterator it = input.iterator(); - while (it.hasNext()) { - TableEntry entry = (TableEntry)it.next(); - if (entry.getExtension().equals(pattern)) { - MessageDialog.openWarning(getShell(), Policy.bind("TextPreferencePage.extensionExistsShort"), Policy.bind("TextPreferencePage.extensionExistsLong")); //$NON-NLS-1$ //$NON-NLS-2$ - return; - } - } - input.add(new TableEntry(pattern, TEXT)); - viewer.refresh(); - } - /** - * Remove the selected items from the table - */ - private void removePattern() { - ISelection selection = viewer.getSelection(); - if (selection == null || !(selection instanceof IStructuredSelection)) { - return; - } - IStructuredSelection ss = (IStructuredSelection)selection; - Iterator it = ss.iterator(); - while (it.hasNext()) { - TableEntry entry = (TableEntry)it.next(); - input.remove(entry); - } - viewer.refresh(); - } - /** - * Toggle the selected items' content types - */ - private void changePattern() { - ISelection selection = viewer.getSelection(); - if (selection == null || !(selection instanceof IStructuredSelection)) { - return; - } - IStructuredSelection ss = (IStructuredSelection)selection; - Iterator it = ss.iterator(); - while (it.hasNext()) { - TableEntry entry = (TableEntry)it.next(); - String string = entry.getValue(); - if (string.equals(TEXT)) { - entry.setValue(BINARY); - } else { - entry.setValue(TEXT); - } - viewer.refresh(entry); - } - } - /** - * The table viewer selection has changed. Update the remove and change button enablement. - */ - private void handleSelection() { - boolean empty = viewer.getSelection().isEmpty(); - removeButton.setEnabled(!empty); - changeButton.setEnabled(!empty); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java deleted file mode 100644 index 5768755f7..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.registry; - -import java.util.Hashtable; - -import org.eclipse.core.runtime.*; -import org.eclipse.team.internal.ui.Utils.Sorter; -import org.eclipse.ui.internal.WorkbenchPlugin; - -public abstract class RegistryReader { - protected static final String TAG_DESCRIPTION = "description"; //$NON-NLS-1$ - protected static Hashtable extensionPoints = new Hashtable(); - /** - * The constructor. - */ - protected RegistryReader() { - } - /** - * This method extracts description as a subelement of the given element. - * - * @return description string if defined, or empty string if not. - */ - protected String getDescription(IConfigurationElement config) { - IConfigurationElement[] children = config.getChildren(TAG_DESCRIPTION); - if (children.length >= 1) { - return children[0].getValue(); - } - return ""; //$NON-NLS-1$ - } - /** - * Logs the error in the workbench log using the provided text and the - * information in the configuration element. - */ - protected void logError(IConfigurationElement element, String text) { - IExtension extension = element.getDeclaringExtension(); - IPluginDescriptor descriptor = extension.getDeclaringPluginDescriptor(); - StringBuffer buf = new StringBuffer(); - buf.append("Plugin " + descriptor.getUniqueIdentifier() + ", extension " + extension.getExtensionPointUniqueIdentifier()); //$NON-NLS-2$//$NON-NLS-1$ - buf.append("\n" + text); //$NON-NLS-1$ - WorkbenchPlugin.log(buf.toString()); - } - /** - * Logs a very common registry error when a required attribute is missing. - */ - protected void logMissingAttribute(IConfigurationElement element, String attributeName) { - logError(element, "Required attribute '" + attributeName + "' not defined"); //$NON-NLS-2$//$NON-NLS-1$ - } - - /** - * Logs a very common registry error when a required child is missing. - */ - protected void logMissingElement(IConfigurationElement element, String elementName) { - logError(element, "Required sub element '" + elementName + "' not defined"); //$NON-NLS-2$//$NON-NLS-1$ - } - - /** - * Logs a registry error when the configuration element is unknown. - */ - protected void logUnknownElement(IConfigurationElement element) { - logError(element, "Unknown extension tag found: " + element.getName()); //$NON-NLS-1$ - } - /** - * Apply a reproducable order to the list of extensions provided, such that - * the order will not change as extensions are added or removed. - */ - protected IExtension[] orderExtensions(IExtension[] extensions) { - // By default, the order is based on plugin id sorted - // in ascending order. The order for a plugin providing - // more than one extension for an extension point is - // dependent in the order listed in the XML file. - Sorter sorter = new Sorter() { - public boolean compare(Object extension1, Object extension2) { - String s1 = ((IExtension) extension1).getDeclaringPluginDescriptor().getUniqueIdentifier(); - String s2 = ((IExtension) extension2).getDeclaringPluginDescriptor().getUniqueIdentifier(); - //Return true if elementTwo is 'greater than' elementOne - return s2.compareToIgnoreCase(s1) > 0; - } - }; - - Object[] sorted = sorter.sort(extensions); - IExtension[] sortedExtension = new IExtension[sorted.length]; - System.arraycopy(sorted, 0, sortedExtension, 0, sorted.length); - return sortedExtension; - } - /** - * Implement this method to read element's attributes. If children should - * also be read, then implementor is responsible for calling <code>readElementChildren</code>. - * Implementor is also responsible for logging missing attributes. - * - * @return true if element was recognized, false if not. - */ - protected abstract boolean readElement(IConfigurationElement element); - /** - * Read the element's children. This is called by the subclass' readElement - * method when it wants to read the children of the element. - */ - protected void readElementChildren(IConfigurationElement element) { - readElements(element.getChildren()); - } - /** - * Read each element one at a time by calling the subclass implementation - * of <code>readElement</code>. - * - * Logs an error if the element was not recognized. - */ - protected void readElements(IConfigurationElement[] elements) { - for (int i = 0; i < elements.length; i++) { - if (!readElement(elements[i])) - logUnknownElement(elements[i]); - } - } - /** - * Read one extension by looping through its configuration elements. - */ - protected void readExtension(IExtension extension) { - readElements(extension.getConfigurationElements()); - } - /** - * Start the registry reading process using the supplied plugin ID and - * extension point. - */ - public void readRegistry(IPluginRegistry registry, String pluginId, String extensionPoint) { - String pointId = pluginId + "-" + extensionPoint; //$NON-NLS-1$ - IExtension[] extensions = (IExtension[]) extensionPoints.get(pointId); - if (extensions == null) { - IExtensionPoint point = registry.getExtensionPoint(pluginId, extensionPoint); - if (point == null) - return; - extensions = point.getExtensions(); - extensionPoints.put(pointId, extensions); - } - for (int i = 0; i < extensions.length; i++) - readExtension(extensions[i]); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java deleted file mode 100644 index 995140b84..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantDescriptor.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.registry; - -import org.eclipse.core.runtime.*; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.internal.WorkbenchPlugin; - -public class SynchronizeParticipantDescriptor implements ISynchronizeParticipantDescriptor { - public static final String ATT_ID = "id"; //$NON-NLS-1$ - public static final String ATT_NAME = "name"; //$NON-NLS-1$ - public static final String ATT_ICON = "icon"; //$NON-NLS-1$ - public static final String ATT_CLASS = "class"; //$NON-NLS-1$ - private static final String ATT_TYPE = "type"; //$NON-NLS-1$ - private static final String ATT_TYPE_STATIC = "static"; //$NON-NLS-1$ - private static final String ATT_SUPPORTS_REFRESH = "supportsRefresh"; //$NON-NLS-1$ - - private String label; - private String className; - private String type; - private String id; - private boolean supportsRefresh; - private ImageDescriptor imageDescriptor; - private String description; - - private IConfigurationElement configElement; - - /** - * Create a new ViewDescriptor for an extension. - */ - public SynchronizeParticipantDescriptor(IConfigurationElement e, String desc) throws CoreException { - configElement = e; - description = desc; - loadFromExtension(); - } - /** - * Return an instance of the declared view. - */ - public IViewPart createView() throws CoreException { - Object obj = WorkbenchPlugin.createExtension(configElement, ATT_CLASS); - return (IViewPart) obj; - } - - public IConfigurationElement getConfigurationElement() { - return configElement; - } - - /** - * Returns this view's description. This is the value of its <code>"description"</code> - * attribute. - * - * @return the description - */ - public String getDescription() { - return description; - } - - public String getId() { - return id; - } - - public String getType() { - return type; - } - - public ImageDescriptor getImageDescriptor() { - if (imageDescriptor != null) - return imageDescriptor; - String iconName = configElement.getAttribute(ATT_ICON); - if (iconName == null) - return null; - imageDescriptor = TeamUIPlugin.getImageDescriptorFromExtension(configElement.getDeclaringExtension(), iconName); - return imageDescriptor; - } - - public String getName() { - return label; - } - - public boolean isStatic() { - if(type == null) return true; - return type.equals(ATT_TYPE_STATIC); - } - - public boolean doesSupportRefresh() { - return supportsRefresh; - } - - /** - * load a view descriptor from the registry. - */ - private void loadFromExtension() throws CoreException { - String identifier = configElement.getAttribute(ATT_ID); - label = configElement.getAttribute(ATT_NAME); - className = configElement.getAttribute(ATT_CLASS); - type = configElement.getAttribute(ATT_TYPE); - String supportsRefreshString = configElement.getAttribute(ATT_SUPPORTS_REFRESH); - if(supportsRefreshString == null) { - supportsRefresh = true; - } else { - supportsRefresh = Boolean.valueOf(supportsRefreshString).booleanValue(); - } - - // Sanity check. - if ((label == null) || (className == null) || (identifier == null)) { - throw new CoreException(new Status(IStatus.ERROR, configElement.getDeclaringExtension().getDeclaringPluginDescriptor().getUniqueIdentifier(), 0, "Invalid extension (missing label or class name): " + identifier, //$NON-NLS-1$ - null)); - } - - id = identifier; - } - - /** - * Returns a string representation of this descriptor. For debugging - * purposes only. - */ - public String toString() { - return "Synchronize Participant(" + getId() + ")"; //$NON-NLS-2$//$NON-NLS-1$ - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantRegistry.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantRegistry.java deleted file mode 100644 index 73ab80fe3..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantRegistry.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.registry; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.team.internal.ui.TeamUIPlugin; - -public class SynchronizeParticipantRegistry extends RegistryReader { - - private static final String TAG_SYNCPARTICIPANT = "participant"; //$NON-NLS-1$ - private Map participants = new HashMap(); - - public SynchronizeParticipantRegistry() { - super(); - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.registry.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement) - */ - protected boolean readElement(IConfigurationElement element) { - if (element.getName().equals(TAG_SYNCPARTICIPANT)) { - String descText = getDescription(element); - SynchronizeParticipantDescriptor desc; - try { - desc = new SynchronizeParticipantDescriptor(element, descText); - participants.put(desc.getId(), desc); - } catch (CoreException e) { - TeamUIPlugin.log(e); - } - return true; - } - return false; - } - - public SynchronizeParticipantDescriptor[] getSynchronizeParticipants() { - return (SynchronizeParticipantDescriptor[])participants.values().toArray(new SynchronizeParticipantDescriptor[participants.size()]); - } - - public SynchronizeParticipantDescriptor find(String id) { - return (SynchronizeParticipantDescriptor)participants.get(id); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java deleted file mode 100644 index a0b90fea1..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java +++ /dev/null @@ -1,346 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.resource.JFaceColors; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.team.core.ITeamStatus; -import org.eclipse.team.core.synchronize.*; -import org.eclipse.team.internal.ui.*; -import org.eclipse.team.ui.ISharedImages; -import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant; -import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipantPage; -import org.eclipse.team.ui.synchronize.viewers.ISynchronizeModelChangeListener; -import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement; -import org.eclipse.ui.forms.HyperlinkGroup; -import org.eclipse.ui.forms.events.HyperlinkAdapter; -import org.eclipse.ui.forms.events.HyperlinkEvent; -import org.eclipse.ui.forms.widgets.FormToolkit; -import org.eclipse.ui.forms.widgets.Hyperlink; -import org.eclipse.ui.part.PageBook; - -/** - * Section shown in a participant page to show the changes for this participant. This - * includes a diff viewer for browsing the changes. - * - * @since 3.0 - */ -public class ChangesSection extends Composite { - - private SubscriberParticipant participant; - private Composite parent; - private SubscriberParticipantPage page; - private FormToolkit forms; - - /** - * Page book either shows the diff tree viewer if there are changes or - * shows a message to the user if there are no changes that would be - * shown in the tree. - */ - private PageBook changesSectionContainer; - - /** - * Shows message to user is no changes are to be shown in the diff - * tree viewer. - */ - private Composite filteredContainer; - - /** - * Diff tree viewer that shows synchronization changes. This is created - * by the participant. - */ - private Viewer changesViewer; - - /** - * Boolean that indicates whether the error page is being shown. - * This is used to avoid redrawing the error page when new events come in - */ - private boolean showingError; - - /** - * Listen to sync set changes so that we can update message to user and totals. - */ - private ISynchronizeModelChangeListener changedListener = new ISynchronizeModelChangeListener() { - public void modelChanged(SynchronizeModelElement root) { - calculateDescription(); - } - }; - - /** - * Listener registered with the subscriber sync info set which contains - * all out-of-sync resources for the subscriber. - */ - private ISyncInfoSetChangeListener subscriberListener = new ISyncInfoSetChangeListener() { - public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) { - // Handled by output set listener - } - public void syncInfoChanged(ISyncInfoSetChangeEvent event, IProgressMonitor monitor) { - calculateDescription(); - } - public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) { - // Handled by output set listener - } - }; - - /** - * Listener registered with the output sync info set which contains - * only the visible sync info. - */ - private ISyncInfoSetChangeListener outputSetListener = new ISyncInfoSetChangeListener() { - public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) { - calculateDescription(); - } - public void syncInfoChanged(ISyncInfoSetChangeEvent event, IProgressMonitor monitor) { - // Input changed listener will call calculateDescription() - // The input will then react to output set changes - } - public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) { - calculateDescription(); - } - }; - - /** - * Create a changes section on the following page. - * - * @param parent the parent control - * @param page the page showing this section - */ - public ChangesSection(Composite parent, SubscriberParticipantPage page) { - super(parent, SWT.NONE); - this.page = page; - this.participant = page.getParticipant(); - this.parent = parent; - - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - setLayout(layout); - GridData data = new GridData(GridData.FILL_BOTH); - data.grabExcessVerticalSpace = true; - setLayoutData(data); - - forms = new FormToolkit(parent.getDisplay()); - forms.setBackground(getBackgroundColor()); - HyperlinkGroup group = forms.getHyperlinkGroup(); - group.setBackground(getBackgroundColor()); - - changesSectionContainer = new PageBook(this, SWT.NONE); - data = new GridData(GridData.FILL_BOTH); - data.grabExcessHorizontalSpace = true; - data.grabExcessVerticalSpace = true; - changesSectionContainer.setLayoutData(data); - } - - public Composite getComposite() { - return changesSectionContainer; - } - - public void setViewer(Viewer viewer) { - this.changesViewer = viewer; - calculateDescription(); - page.getViewerConfiguration().addInputChangedListener(changedListener); - participant.getSubscriberSyncInfoCollector().getSubscriberSyncInfoSet().addSyncSetChangedListener(subscriberListener); - participant.getSubscriberSyncInfoCollector().getSyncInfoTree().addSyncSetChangedListener(outputSetListener); - } - - private void calculateDescription() { - SyncInfoTree syncInfoTree = participant.getSubscriberSyncInfoCollector().getSyncInfoTree(); - if (syncInfoTree.getErrors().length > 0) { - if (!showingError) { - TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() { - public void run() { - if (changesSectionContainer.isDisposed()) return; - if(filteredContainer != null) { - filteredContainer.dispose(); - filteredContainer = null; - } - filteredContainer = getErrorComposite(changesSectionContainer); - changesSectionContainer.showPage(filteredContainer); - showingError = true; - } - }); - } - return; - } - - showingError = false; - if(syncInfoTree.size() == 0) { - TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() { - public void run() { - if (changesSectionContainer.isDisposed()) return; - if(filteredContainer != null) { - filteredContainer.dispose(); - filteredContainer = null; - } - filteredContainer = getEmptyChangesComposite(changesSectionContainer); - changesSectionContainer.showPage(filteredContainer); - } - }); - } else { - TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() { - public void run() { - if(filteredContainer != null) { - filteredContainer.dispose(); - filteredContainer = null; - } - changesSectionContainer.showPage(changesViewer.getControl()); - } - }); - } - } - - private boolean isThreeWay() { - return page.getParticipant().getSubscriber().getResourceComparator().isThreeWay(); - } - - private Composite getEmptyChangesComposite(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); - composite.setBackground(getBackgroundColor()); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - composite.setLayout(layout); - GridData data = new GridData(GridData.FILL_BOTH); - data.grabExcessVerticalSpace = true; - composite.setLayoutData(data); - - if(! isThreeWay()) { - createDescriptionLabel(composite,Policy.bind("ChangesSection.noChanges", participant.getName())); //$NON-NLS-1$ - return composite; - } - - SyncInfoSet workspace = participant.getSubscriberSyncInfoCollector().getSubscriberSyncInfoSet(); - SyncInfoSet workingSet = participant.getSubscriberSyncInfoCollector().getWorkingSetSyncInfoSet(); - SyncInfoSet filteredSet = participant.getSubscriberSyncInfoCollector().getSyncInfoTree(); - - int changesInWorkspace = workspace.size(); - int changesInWorkingSet = workingSet.size(); - int changesInFilter = filteredSet.size(); - - long outgoingChanges = workingSet.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK); - long incomingChanges = workingSet.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK); - - if(changesInFilter == 0 && changesInWorkingSet != 0) { - int mode = participant.getMode(); - final int newMode = outgoingChanges != 0 ? SubscriberParticipant.OUTGOING_MODE : SubscriberParticipant.INCOMING_MODE; - long numChanges = outgoingChanges != 0 ? outgoingChanges : incomingChanges; - StringBuffer text = new StringBuffer(); - text.append(Policy.bind("ChangesSection.filterHides", Utils.modeToString(participant.getMode()))); //$NON-NLS-1$ - if(numChanges > 1) { - text.append(Policy.bind("ChangesSection.filterHidesPlural", Long.toString(numChanges), Utils.modeToString(newMode))); //$NON-NLS-1$ - } else { - text.append(Policy.bind("ChangesSection.filterHidesSingular", Long.toString(numChanges), Utils.modeToString(newMode))); //$NON-NLS-1$ - } - - Label warning = new Label(composite, SWT.NONE); - warning.setImage(TeamUIPlugin.getPlugin().getImage(ISharedImages.IMG_WARNING)); - - Hyperlink link = forms.createHyperlink(composite, Policy.bind("ChangesSection.filterChange", Utils.modeToString(newMode)), SWT.WRAP); //$NON-NLS-1$ - link.addHyperlinkListener(new HyperlinkAdapter() { - public void linkActivated(HyperlinkEvent e) { - participant.setMode(newMode); - } - }); - forms.getHyperlinkGroup().add(link); - createDescriptionLabel(composite, text.toString()); - } else if(changesInFilter == 0 && changesInWorkingSet == 0 && changesInWorkspace != 0) { - Label warning = new Label(composite, SWT.NONE); - warning.setImage(TeamUIPlugin.getPlugin().getImage(ISharedImages.IMG_WARNING)); - - Hyperlink link = forms.createHyperlink(composite, Policy.bind("ChangesSection.workingSetRemove"), SWT.WRAP); //$NON-NLS-1$ - link.addHyperlinkListener(new HyperlinkAdapter() { - public void linkActivated(HyperlinkEvent e) { - participant.setWorkingSet(null); - } - }); - forms.getHyperlinkGroup().add(link); - createDescriptionLabel(composite,Policy.bind("ChangesSection.workingSetHiding", Utils.workingSetToString(participant.getWorkingSet(), 50))); //$NON-NLS-1$ - } else { - createDescriptionLabel(composite,Policy.bind("ChangesSection.noChanges", participant.getName())); //$NON-NLS-1$ - } - return composite; - } - - private Label createDescriptionLabel(Composite parent, String text) { - Label description = new Label(parent, SWT.WRAP); - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalSpan = 2; - data.widthHint = 100; - description.setLayoutData(data); - description.setText(text); - description.setBackground(getBackgroundColor()); - return description; - } - - public void dispose() { - super.dispose(); - page.getViewerConfiguration().removeInputChangedListener(changedListener); - participant.getSubscriberSyncInfoCollector().getSubscriberSyncInfoSet().removeSyncSetChangedListener(subscriberListener); - } - - private Composite getErrorComposite(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); - composite.setBackground(getBackgroundColor()); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - composite.setLayout(layout); - GridData data = new GridData(GridData.FILL_BOTH); - data.grabExcessVerticalSpace = true; - composite.setLayoutData(data); - - Hyperlink link = new Hyperlink(composite, SWT.WRAP); - link.setText(Policy.bind("ChangesSection.8")); //$NON-NLS-1$ - link.addHyperlinkListener(new HyperlinkAdapter() { - public void linkActivated(HyperlinkEvent e) { - showErrors(); - } - }); - link.setBackground(getBackgroundColor()); - link.setUnderlined(true); - - link = new Hyperlink(composite, SWT.WRAP); - link.setText(Policy.bind("ChangesSection.9")); //$NON-NLS-1$ - link.addHyperlinkListener(new HyperlinkAdapter() { - public void linkActivated(HyperlinkEvent e) { - participant.getSubscriberSyncInfoCollector().reset(); - } - }); - link.setBackground(getBackgroundColor()); - link.setUnderlined(true); - - createDescriptionLabel(composite, Policy.bind("ChangesSection.10", participant.getName())); //$NON-NLS-1$ - - return composite; - } - - /* private */ void showErrors() { - ITeamStatus[] status = participant.getSubscriberSyncInfoCollector().getSyncInfoTree().getErrors(); - String title = Policy.bind("ChangesSection.11"); //$NON-NLS-1$ - if (status.length == 1) { - ErrorDialog.openError(getShell(), title, status[0].getMessage(), status[0]); - } else { - MultiStatus multi = new MultiStatus(TeamUIPlugin.ID, 0, status, Policy.bind("ChangesSection.12"), null); //$NON-NLS-1$ - ErrorDialog.openError(getShell(), title, null, multi); - } - } - - protected Color getBackgroundColor() { - return JFaceColors.getSchemeBackground(parent.getDisplay()); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java deleted file mode 100644 index 786d85898..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java +++ /dev/null @@ -1,282 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize; - -import java.util.*; - -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.resources.*; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.team.core.synchronize.*; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.ui.ISharedImages; -import org.eclipse.team.ui.synchronize.viewers.*; - -public class CompressedFoldersModelProvider extends HierarchicalModelProvider { - - protected class UnchangedCompressedDiffNode extends UnchangedResourceModelElement { - public UnchangedCompressedDiffNode(IDiffContainer parent, IResource resource) { - super(parent, resource); - } - - /* (non-Javadoc) - * @see org.eclipse.compare.structuremergeviewer.DiffNode#getName() - */ - public String getName() { - IResource resource = getResource(); - return resource.getProjectRelativePath().toString(); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.SyncInfoModelElement#getImageDescriptor(java.lang.Object) - */ - public ImageDescriptor getImageDescriptor(Object object) { - return TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_COMPRESSED_FOLDER); - } - } - - /** - * A compressed folder appears under a project and contains out-of-sync resources - */ - public class CompressedFolderDiffNode extends SyncInfoModelElement { - - public CompressedFolderDiffNode(IDiffContainer parent, SyncInfo info) { - super(parent, info); - } - - /* (non-Javadoc) - * @see org.eclipse.compare.structuremergeviewer.DiffNode#getName() - */ - public String getName() { - IResource resource = getResource(); - return resource.getProjectRelativePath().toString(); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.SyncInfoModelElement#getImageDescriptor(java.lang.Object) - */ - public ImageDescriptor getImageDescriptor(Object object) { - return TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_COMPRESSED_FOLDER); - } - } - - public CompressedFoldersModelProvider(SyncInfoTree set) { - super(set); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.SyncInfoDiffNodeRoot#getSorter() - */ - public ViewerSorter getViewerSorter() { - return new SynchronizeModelElementSorter() { - protected int compareNames(IResource resource1, IResource resource2) { - if (resource1.getType() == IResource.FOLDER && resource2.getType() == IResource.FOLDER) { - return collator.compare(resource1.getProjectRelativePath().toString(), resource2.getProjectRelativePath().toString()); - } - return super.compareNames(resource1, resource2); - } - }; - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.viewers.HierarchicalModelProvider#createModelObjects(org.eclipse.compare.structuremergeviewer.DiffNode) - */ - protected IDiffElement[] createModelObjects(SynchronizeModelElement container) { - IResource resource = null; - if (container == getModelRoot()) { - resource = ResourcesPlugin.getWorkspace().getRoot(); - } else { - resource = container.getResource(); - } - if(resource != null) { - if (resource.getType() == IResource.PROJECT) { - return getProjectChildren(container, (IProject)resource); - } - if (resource.getType() == IResource.FOLDER) { - return getFolderChildren(container, resource); - } - } - return super.createModelObjects(container); - } - - private IDiffElement[] getFolderChildren(SynchronizeModelElement parent, IResource resource) { - // Folders will only contain out-of-sync children - IResource[] children = getSyncInfoTree().members(resource); - List result = new ArrayList(); - for (int i = 0; i < children.length; i++) { - IResource child = children[i]; - if (child.getType() == IResource.FILE) { - result.add(createModelObject(parent, child)); - } - } - return (IDiffElement[])result.toArray(new IDiffElement[result.size()]); - } - - private IDiffElement[] getProjectChildren(SynchronizeModelElement parent, IProject project) { - // The out-of-sync elements could possibly include the project so the code - // below is written to ignore the project - SyncInfo[] outOfSync = getSyncInfoTree().getSyncInfos(project, IResource.DEPTH_INFINITE); - Set result = new HashSet(); - Set resourcesToShow = new HashSet(); - for (int i = 0; i < outOfSync.length; i++) { - SyncInfo info = outOfSync[i]; - IResource local = info.getLocal(); - if (local.getProjectRelativePath().segmentCount() == 1 && local.getType() == IResource.FILE) { - resourcesToShow.add(local); - } else { - if (local.getType() == IResource.FILE) { - resourcesToShow.add(local.getParent()); - } else if (local.getType() == IResource.FOLDER){ - resourcesToShow.add(local); - } - } - } - for (Iterator iter = resourcesToShow.iterator(); iter.hasNext();) { - IResource resource = (IResource) iter.next(); - result.add(createModelObject(parent, resource)); - } - - return (IDiffElement[])result.toArray(new IDiffElement[result.size()]); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.views.HierarchicalModelProvider#createChildNode(org.eclipse.compare.structuremergeviewer.DiffNode, org.eclipse.core.resources.IResource) - */ - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.viewers.HierarchicalModelProvider#createModelObject(org.eclipse.compare.structuremergeviewer.DiffNode, org.eclipse.core.resources.IResource) - */ - protected SynchronizeModelElement createModelObject(SynchronizeModelElement parent, IResource resource) { - if (resource.getType() == IResource.FOLDER) { - SyncInfo info = getSyncInfoTree().getSyncInfo(resource); - SynchronizeModelElement newNode; - if(info != null) { - newNode = new CompressedFolderDiffNode(parent, info); - } else { - newNode = new UnchangedCompressedDiffNode(parent, resource); - } - addToViewer(newNode); - return newNode; - } - return super.createModelObject(parent, resource); - } - - /** - * Update the viewer for the sync set additions in the provided event. - * This method is invoked by <code>handleChanges(ISyncInfoSetChangeEvent)</code>. - * Subclasses may override. - * @param event - */ - protected void handleResourceAdditions(ISyncInfoTreeChangeEvent event) { - SyncInfo[] infos = event.getAddedResources(); - for (int i = 0; i < infos.length; i++) { - SyncInfo info = infos[i]; - addResource(info); - } - } - - private void addResource(SyncInfo info) { - IResource local = info.getLocal(); - SynchronizeModelElement existingNode = getModelObject(local); - if (existingNode == null) { - if (local.getType() == IResource.FILE) { - SynchronizeModelElement parentNode = getModelObject(local.getParent()); - if (parentNode == null) { - SynchronizeModelElement projectNode = getModelObject(local.getProject()); - if (projectNode == null) { - projectNode = createModelObject(getModelRoot(), local.getProject()); - } - if (local.getParent().getType() == IResource.PROJECT) { - parentNode = projectNode; - } else { - parentNode = createModelObject(projectNode, local.getParent()); - } - } - createModelObject(parentNode, local); - } else { - SynchronizeModelElement projectNode = getModelObject(local.getProject()); - if (projectNode == null) { - projectNode = createModelObject(getModelRoot(), local.getProject()); - } - createModelObject(projectNode, local); - } - } else { - // Either The folder node was added as the parent of a newly added out-of-sync file - // or the file was somehow already there so just refresh - handleChange(existingNode, info); - } - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.sync.views.SyncSetContentProvider#handleResourceRemovals(org.eclipse.team.internal.ui.sync.views.SyncSetChangedEvent) - */ - protected void handleResourceRemovals(ISyncInfoTreeChangeEvent event) { - IResource[] roots = event.getRemovedSubtreeRoots(); - - // First, deal with any projects that have been removed - List removedProjects = new ArrayList(); - for (int i = 0; i < roots.length; i++) { - IResource resource = roots[i]; - if (resource.getType() == IResource.PROJECT) { - removeFromViewer(resource); - removedProjects.add(resource); - } - } - - IResource[] resources = event.getRemovedResources(); - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - if (!removedProjects.contains(resource.getProject())) { - if (resource.getType() == IResource.FILE) { - if (isCompressedParentEmpty(resource)) { - // The parent compressed folder is also empty so remove it - removeFromViewer(resource.getParent()); - } else { - removeFromViewer(resource); - } - } else { - // A folder has been removed (i.e. is in-sync) - // but may still contain children - removeFromViewer(resource); - if (hasFileMembers((IContainer)resource)) { - createModelObject(getModelObject(resource.getProject()), resource); - buildModelObjects(getModelObject(resource)); - } - } - } - } - } - - private boolean isCompressedParentEmpty(IResource resource) { - IContainer parent = resource.getParent(); - if (parent == null - || parent.getType() == IResource.ROOT - || parent.getType() == IResource.PROJECT) { - return false; - } - return !hasFileMembers(parent); - } - - private boolean hasFileMembers(IContainer parent) { - // Check if the sync set has any file children of the parent - IResource[] members = getSyncInfoTree().members(parent); - for (int i = 0; i < members.length; i++) { - IResource member = members[i]; - if (member.getType() == IResource.FILE) { - return true; - } - } - // The parent does not contain any files - return false; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java deleted file mode 100644 index 63f241520..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java +++ /dev/null @@ -1,194 +0,0 @@ -package org.eclipse.team.internal.ui.synchronize; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.*; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.*; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.dialogs.DetailsDialog; -import org.eclipse.team.ui.synchronize.subscriber.SubscriberRefreshSchedule; - - -public class ConfigureRefreshScheduleDialog extends DetailsDialog { - - private SubscriberRefreshSchedule schedule; - private Button userRefreshOnly; - private Button enableBackgroundRefresh; - private Text time; - private Combo hoursOrSeconds; - - public ConfigureRefreshScheduleDialog(Shell parentShell, SubscriberRefreshSchedule schedule) { - super(parentShell, Policy.bind("ConfigureRefreshScheduleDialog.0", schedule.getParticipant().getName())); //$NON-NLS-1$ - this.schedule = schedule; - } - - private void initializeValues() { - boolean enableBackground = schedule.isEnabled(); - boolean hours = false; - - userRefreshOnly.setSelection(! enableBackground); - enableBackgroundRefresh.setSelection(enableBackground); - - long seconds = schedule.getRefreshInterval(); - if(seconds <= 60) { - seconds = 60; - } - - long minutes = seconds / 60; - - if(minutes >= 60) { - minutes = minutes / 60; - hours = true; - } - hoursOrSeconds.select(hours ? 0 : 1); - time.setText(Long.toString(minutes)); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) - */ - protected void createMainDialogArea(Composite parent) { - Composite area = new Composite(parent, SWT.NONE); - final GridLayout gridLayout = new GridLayout(); - gridLayout.numColumns = 2; - area.setLayout(gridLayout); - area.setLayoutData(new GridData(GridData.FILL_BOTH)); - - { - final Label label = new Label(area, SWT.WRAP); - final GridData gridData = new GridData(GridData.FILL_BOTH); - gridData.horizontalSpan = 2; - gridData.widthHint = 325; - label.setLayoutData(gridData); - label.setText(Policy.bind("ConfigureRefreshScheduleDialog.1", schedule.getParticipant().getName())); //$NON-NLS-1$ - } - { - final Label label = new Label(area, SWT.WRAP); - final GridData gridData = new GridData(GridData.FILL_BOTH); - gridData.horizontalSpan = 2; - gridData.widthHint = 325; - label.setLayoutData(gridData); - label.setText(Policy.bind("ConfigureRefreshScheduleDialog.1a", SubscriberRefreshSchedule.refreshEventAsString(schedule.getLastRefreshEvent()))); //$NON-NLS-1$ - } - { - userRefreshOnly = new Button(area, SWT.RADIO); - final GridData gridData = new GridData(); - gridData.horizontalSpan = 2; - userRefreshOnly.setLayoutData(gridData); - userRefreshOnly.setText(Policy.bind("ConfigureRefreshScheduleDialog.2")); //$NON-NLS-1$ - userRefreshOnly.addSelectionListener(new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - updateEnablements(); - } - public void widgetDefaultSelected(SelectionEvent e) { - } - }); - } - { - enableBackgroundRefresh = new Button(area, SWT.RADIO); - final GridData gridData = new GridData(); - gridData.horizontalSpan = 2; - enableBackgroundRefresh.setLayoutData(gridData); - enableBackgroundRefresh.setText(Policy.bind("ConfigureRefreshScheduleDialog.3")); //$NON-NLS-1$ - enableBackgroundRefresh.addSelectionListener(new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - updateEnablements(); - } - public void widgetDefaultSelected(SelectionEvent e) { - } - }); - } - { - final Composite composite = new Composite(area, SWT.NONE); - final GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_BEGINNING); - gridData.horizontalSpan = 2; - composite.setLayoutData(gridData); - final GridLayout gridLayout_1 = new GridLayout(); - gridLayout_1.numColumns = 3; - composite.setLayout(gridLayout_1); - { - final Label label = new Label(composite, SWT.NONE); - label.setText(Policy.bind("ConfigureRefreshScheduleDialog.4")); //$NON-NLS-1$ - } - { - time = new Text(composite, SWT.BORDER | SWT.RIGHT); - final GridData gridData_1 = new GridData(); - gridData_1.widthHint = 35; - time.setLayoutData(gridData_1); - time.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - updateEnablements(); - } - }); - } - { - hoursOrSeconds = new Combo(composite, SWT.READ_ONLY); - hoursOrSeconds.setItems(new String[] { Policy.bind("ConfigureRefreshScheduleDialog.5"), Policy.bind("ConfigureRefreshScheduleDialog.6") }); //$NON-NLS-1$ //$NON-NLS-2$ - final GridData gridData_1 = new GridData(); - gridData_1.widthHint = 75; - hoursOrSeconds.setLayoutData(gridData_1); - } - } - initializeValues(); - Dialog.applyDialogFont(parent); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.Dialog#okPressed() - */ - protected void okPressed() { - int hours = hoursOrSeconds.getSelectionIndex(); - long seconds = Long.parseLong(time.getText()); - if(hours == 0) { - seconds = seconds * 3600; - } else { - seconds = seconds * 60; - } - schedule.setRefreshInterval(seconds); - if(schedule.isEnabled() != enableBackgroundRefresh.getSelection()) { - schedule.setEnabled(enableBackgroundRefresh.getSelection(), true /* allow to start */); - } - - // update schedule - schedule.getParticipant().setRefreshSchedule(schedule); - super.okPressed(); - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#createDropDownDialogArea(org.eclipse.swt.widgets.Composite) - */ - protected Composite createDropDownDialogArea(Composite parent) { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#updateEnablements() - */ - protected void updateEnablements() { - try { - long number = Long.parseLong(time.getText()); - if(number <= 0) { - setPageComplete(false); - setErrorMessage(Policy.bind("ConfigureRefreshScheduleDialog.7")); //$NON-NLS-1$ - } else { - setPageComplete(true); - setErrorMessage(null); - } - } catch (NumberFormatException e) { - setPageComplete(false); - setErrorMessage(Policy.bind("ConfigureRefreshScheduleDialog.8")); //$NON-NLS-1$ - } - - time.setEnabled(enableBackgroundRefresh.getSelection()); - hoursOrSeconds.setEnabled(enableBackgroundRefresh.getSelection()); - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#includeDetailsButton() - */ - protected boolean includeDetailsButton() { - return false; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DiffNodeWorkbenchAdapter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DiffNodeWorkbenchAdapter.java deleted file mode 100644 index ea3991bb8..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DiffNodeWorkbenchAdapter.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize; - -import org.eclipse.compare.structuremergeviewer.DiffNode; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement; -import org.eclipse.ui.model.IWorkbenchAdapter; - -public class DiffNodeWorkbenchAdapter implements IWorkbenchAdapter { - - /* (non-Javadoc) - * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object) - */ - public Object[] getChildren(Object o) { - DiffNode node = getDiffNode(o); - return node != null ? node.getChildren() : new Object[0]; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object) - */ - public ImageDescriptor getImageDescriptor(Object o) { - DiffNode node = getDiffNode(o); - if(node instanceof SynchronizeModelElement) { - return ((SynchronizeModelElement)node).getImageDescriptor(o); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object) - */ - public String getLabel(Object o) { - DiffNode node = getDiffNode(o); - return node != null ? node.getName() : ""; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object) - */ - public Object getParent(Object o) { - DiffNode node = getDiffNode(o); - return node != null ? node.getParent() : null; - } - - /* - * Return a diff node if the input object is a diff node or null otherwise. - */ - private DiffNode getDiffNode(Object element) { - if(element instanceof DiffNode) { - return (DiffNode)element; - } - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java deleted file mode 100644 index 7ecfb3a56..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java +++ /dev/null @@ -1,231 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize; - -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.jface.viewers.AbstractTreeViewer; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.team.core.synchronize.*; -import org.eclipse.team.ui.synchronize.viewers.*; - -/** - * An input that can be used with both {@link } and - * {@link }. The - * job of this input is to create the logical model of the contents of the - * sync set for displaying to the user. The created logical model must diff - * nodes. - * <p> - * 1. First, prepareInput is called to initialize the model with the given sync - * set. Building the model occurs in the ui thread. - * 2. The input must react to changes in the sync set and adjust its diff node - * model then update the viewer. In effect mediating between the sync set - * changes and the model shown to the user. This happens in the ui thread. - * </p> - * NOT ON DEMAND - model is created then maintained! - * @since 3.0 - */ -public class HierarchicalModelProvider extends SynchronizeModelProvider { - - /** - * Create an input based on the provide sync set. The input is not initialized - * until <code>prepareInput</code> is called. - * - * @param set the sync set used as the basis for the model created by this input. - */ - public HierarchicalModelProvider(SyncInfoTree set) { - super(set); - } - - public ViewerSorter getViewerSorter() { - return new SynchronizeModelElementSorter(); - } - - protected SyncInfoTree getSyncInfoTree() { - return (SyncInfoTree)getSyncInfoSet(); - } - - /** - * Invoked by the <code>buildModelObject</code> method to create - * the childen of the given node. This method can be overriden - * by subclasses but subclasses should inv - * @param container - * @return - */ - protected IDiffElement[] createModelObjects(SynchronizeModelElement container) { - IResource resource = null; - if (container == getModelRoot()) { - resource = ResourcesPlugin.getWorkspace().getRoot(); - } else { - resource = container.getResource(); - } - if(resource != null) { - SyncInfoTree infoTree = getSyncInfoTree(); - IResource[] children = infoTree.members(resource); - SynchronizeModelElement[] nodes = new SynchronizeModelElement[children.length]; - for (int i = 0; i < children.length; i++) { - nodes[i] = createModelObject(container, children[i]); - } - return nodes; - } - return new IDiffElement[0]; - } - - protected SynchronizeModelElement createModelObject(SynchronizeModelElement parent, IResource resource) { - SyncInfo info = getSyncInfoTree().getSyncInfo(resource); - SynchronizeModelElement newNode; - if(info != null) { - newNode = new SyncInfoModelElement(parent, info); - } else { - newNode = new UnchangedResourceModelElement(parent, resource); - } - addToViewer(newNode); - return newNode; - } - - /** - * Invokes <code>getModelObject(Object)</code> on an array of resources. - * @param resources - * the resources - * @return the model objects for the resources - */ - protected Object[] getModelObjects(IResource[] resources) { - Object[] result = new Object[resources.length]; - for (int i = 0; i < resources.length; i++) { - result[i] = getModelObject(resources[i]); - } - return result; - } - - /** - * Handle the change for the existing diff node. The diff node - * should be changed to have the given sync info - * @param diffNode the diff node to be changed - * @param info the new sync info for the diff node - */ - protected void handleChange(SynchronizeModelElement diffNode, SyncInfo info) { - IResource local = info.getLocal(); - // TODO: Get any additional sync bits - if(diffNode instanceof SyncInfoModelElement) { - boolean wasConflict = isConflicting(diffNode); - // The update preserves any of the additional sync info bits - ((SyncInfoModelElement)diffNode).update(info); - boolean isConflict = isConflicting(diffNode); - updateLabel(diffNode); - if (wasConflict && !isConflict) { - setParentConflict(diffNode, false); - } else if (!wasConflict && isConflict) { - setParentConflict(diffNode, true); - } - } else { - removeFromViewer(local); - addResources(new IResource[] {local}); - } - // TODO: set any additional sync info bits - } - - protected void addResources(IResource[] added) { - for (int i = 0; i < added.length; i++) { - IResource resource = added[i]; - SynchronizeModelElement node = getModelObject(resource); - if (node != null) { - // Somehow the node exists. Remove it and read it to ensure - // what is shown matches the contents of the sync set - removeFromViewer(resource); - } - // Build the sub-tree rooted at this node - SynchronizeModelElement parent = getModelObject(resource.getParent()); - if (parent != null) { - node = createModelObject(parent, resource); - buildModelObjects(node); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#buildModelObjects(org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement) - */ - protected IDiffElement[] buildModelObjects(SynchronizeModelElement node) { - IDiffElement[] children = createModelObjects(node); - for (int i = 0; i < children.length; i++) { - IDiffElement element = children[i]; - if (element instanceof SynchronizeModelElement) { - buildModelObjects((SynchronizeModelElement) element); - } - } - return children; - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#doAdd(org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement, org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement) - */ - protected void doAdd(SynchronizeModelElement parent, SynchronizeModelElement element) { - AbstractTreeViewer viewer = (AbstractTreeViewer)getViewer(); - viewer.add(parent, element); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#doRemove(org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement) - */ - protected void doRemove(SynchronizeModelElement element) { - AbstractTreeViewer viewer = (AbstractTreeViewer)getViewer(); - viewer.remove(element); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#handleResourceAdditions(org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent) - */ - protected void handleResourceAdditions(ISyncInfoTreeChangeEvent event) { - IResource[] added = event.getAddedSubtreeRoots(); - addResources(added); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#handleResourceChanges(org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent) - */ - protected void handleResourceChanges(ISyncInfoTreeChangeEvent event) { - // Refresh the viewer for each changed resource - SyncInfo[] infos = event.getChangedResources(); - for (int i = 0; i < infos.length; i++) { - SyncInfo info = infos[i]; - IResource local = info.getLocal(); - SynchronizeModelElement diffNode = getModelObject(local); - if (diffNode != null) { - handleChange(diffNode, info); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#handleResourceRemovals(org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent) - */ - protected void handleResourceRemovals(ISyncInfoTreeChangeEvent event) { - // Remove the removed subtrees - IResource[] removedRoots = event.getRemovedSubtreeRoots(); - for (int i = 0; i < removedRoots.length; i++) { - removeFromViewer(removedRoots[i]); - } - // We have to look for folders that may no longer be in the set - // (i.e. are in-sync) but still have descendants in the set - IResource[] removedResources = event.getRemovedResources(); - for (int i = 0; i < removedResources.length; i++) { - IResource resource = removedResources[i]; - if (resource.getType() != IResource.FILE) { - SynchronizeModelElement node = getModelObject(resource); - if (node != null) { - removeFromViewer(resource); - addResources(new IResource[] {resource}); - } - } - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceTypedElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceTypedElement.java deleted file mode 100644 index 4ea6fa6f0..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceTypedElement.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize; - -import java.io.*; - -import org.eclipse.compare.*; -import org.eclipse.compare.internal.BufferedResourceNode; -import org.eclipse.compare.structuremergeviewer.IStructureComparator; -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; - -/** - * A resource node that is not buffered. Changes made to it are applied directly - * to the underlying resource. - * - * @since 3.0 - */ -public class LocalResourceTypedElement extends ResourceNode { - - private boolean fDirty= false; - private IFile fDeleteFile; - - /** - * Creates a <code>ResourceNode</code> for the given resource. - * - * @param resource the resource - */ - public LocalResourceTypedElement(IResource resource) { - super(resource); - } - - protected IStructureComparator createChild(IResource child) { - return new LocalResourceTypedElement(child); - } - - public void setContent(byte[] contents) { - fDirty= true; - super.setContent(contents); - } - - /** - * Commits buffered contents to resource. - */ - public void commit(IProgressMonitor pm) throws CoreException { - if (fDirty) { - - if (fDeleteFile != null) { - fDeleteFile.delete(true, true, pm); - return; - } - - IResource resource= getResource(); - if (resource instanceof IFile) { - ByteArrayInputStream is= new ByteArrayInputStream(getContent()); - try { - IFile file= (IFile) resource; - if (file.exists()) - file.setContents(is, false, true, pm); - else - file.create(is, false, pm); - fDirty= false; - } finally { - fireContentChanged(); - if (is != null) - try { - is.close(); - } catch(IOException ex) { - } - } - } - } - } - - public ITypedElement replace(ITypedElement child, ITypedElement other) { - - if (child == null) { // add resource - // create a node without a resource behind it! - IResource resource= getResource(); - if (resource instanceof IFolder) { - IFolder folder= (IFolder) resource; - IFile file= folder.getFile(other.getName()); - child= new BufferedResourceNode(file); - } - } - - if (other == null) { // delete resource - IResource resource= getResource(); - if (resource instanceof IFolder) { - IFolder folder= (IFolder) resource; - IFile file= folder.getFile(child.getName()); - if (file != null && file.exists()) { - fDeleteFile= file; - fDirty= true; - } - } - return null; - } - - if (other instanceof IStreamContentAccessor && child instanceof IEditableContent) { - IEditableContent dst= (IEditableContent) child; - - try { - InputStream is= ((IStreamContentAccessor)other).getContents(); - byte[] bytes= readBytes(is); - if (bytes != null) - dst.setContent(bytes); - } catch (CoreException ex) { - } - } - fireContentChanged(); - return child; - } - - public static byte[] readBytes(InputStream in) { - ByteArrayOutputStream bos= new ByteArrayOutputStream(); - try { - while (true) { - int c= in.read(); - if (c == -1) - break; - bos.write(c); - } - - } catch (IOException ex) { - return null; - - } finally { - if (in != null) { - try { - in.close(); - } catch (IOException x) { - } - } - try { - bos.close(); - } catch (IOException x) { - } - } - return bos.toByteArray(); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.java deleted file mode 100644 index 5d96ae5de..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.java +++ /dev/null @@ -1,282 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.compare.CompareConfiguration; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.*; -import org.eclipse.team.core.subscribers.FilteredSyncInfoCollector; -import org.eclipse.team.core.synchronize.*; -import org.eclipse.team.internal.ui.*; -import org.eclipse.team.internal.ui.dialogs.DetailsDialog; -import org.eclipse.team.ui.synchronize.subscriber.IRefreshEvent; -import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant; -import org.eclipse.team.ui.synchronize.viewers.SynchronizeCompareInput; -import org.eclipse.team.ui.synchronize.viewers.TreeViewerAdvisor; - -public class RefreshCompleteDialog extends DetailsDialog { - // For remembering the dialog sizings - private static final String HEIGHT_KEY = "width-key"; //$NON-NLS-1$ - private static final String WIDTH_KEY = "height-key"; //$NON-NLS-1$ - - private SyncInfoFilter filter; - private FilteredSyncInfoCollector collector; - private SynchronizeCompareInput compareEditorInput; - private IRefreshEvent event; - private SubscriberParticipant participant; - - private Button dontShowAgainButton; - - private IDialogSettings settings; - private SyncInfoTree syncInfoSet = new SyncInfoTree(); - - public RefreshCompleteDialog(Shell parentShell, IRefreshEvent event, SubscriberParticipant participant) { - super(parentShell, Policy.bind("RefreshCompleteDialog.4", participant.getName())); //$NON-NLS-1$ - this.participant = participant; - int shellStyle = getShellStyle(); - setShellStyle(shellStyle | SWT.RESIZE | SWT.MAX); - this.event = event; - setImageKey(DLG_IMG_INFO); - // Set-up a sync info set that contains the resources that where found - // when the refresh occured. - filter = new SyncInfoFilter() { - public boolean select(SyncInfo info, IProgressMonitor monitor) { - IResource[] resources = getResources(); - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - if (info.getLocal().equals(resource)) { - return true; - } - } - return false; - } - }; - this.collector = new FilteredSyncInfoCollector( - participant.getSubscriberSyncInfoCollector().getSubscriberSyncInfoSet(), - syncInfoSet, - filter); - IDialogSettings workbenchSettings = TeamUIPlugin.getPlugin().getDialogSettings(); - this.settings = workbenchSettings.getSection("RefreshCompleteDialog");//$NON-NLS-1$ - if (settings == null) { - this.settings = workbenchSettings.addNewSection("RefreshCompleteDialog");//$NON-NLS-1$ - } - } - - /** - * Populate the dialog with the new changes discovered during the refresh - */ - public void initialize() { - this.collector.start(new NullProgressMonitor()); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.window.Window#close() - */ - public boolean close() { - collector.dispose(); - Rectangle bounds = getShell().getBounds(); - settings.put(HEIGHT_KEY, bounds.height); - settings.put(WIDTH_KEY, bounds.width); - return super.close(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) - */ - protected void createButtonsForButtonBar(Composite parent) { - super.createButtonsForButtonBar(parent); - } - - protected Combo createCombo(Composite parent, int widthChars) { - Combo combo = new Combo(parent, SWT.READ_ONLY); - GridData data = new GridData(GridData.FILL_HORIZONTAL); - GC gc = new GC(combo); - gc.setFont(combo.getFont()); - FontMetrics fontMetrics = gc.getFontMetrics(); - data.widthHint = Dialog.convertWidthInCharsToPixels(fontMetrics, widthChars); - gc.dispose(); - combo.setLayoutData(data); - return combo; - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#createDropDownDialogArea(org.eclipse.swt.widgets.Composite) - */ - protected Composite createDropDownDialogArea(Composite parent) { - try { - CompareConfiguration compareConfig = new CompareConfiguration(); - TreeViewerAdvisor viewerAdvisor = new TreeViewerAdvisor(syncInfoSet); - compareEditorInput = new SynchronizeCompareInput(compareConfig, viewerAdvisor) { - public String getTitle() { - return Policy.bind("RefreshCompleteDialog.9"); //$NON-NLS-1$ - } - }; - // Preparing the input should be fast since we haven't started the collector - compareEditorInput.run(new NullProgressMonitor()); - // Starting the collector will populate the dialog in the background - initialize(); - } catch (InterruptedException e) { - Utils.handle(e); - } catch (InvocationTargetException e) { - Utils.handle(e); - } - Composite result = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - result.setLayout(layout); - GridData data = new GridData(GridData.FILL_BOTH); - data.grabExcessHorizontalSpace = true; - data.grabExcessVerticalSpace = true; - data.heightHint = 350; - //data.widthHint = 700; - result.setLayoutData(data); - Control c = compareEditorInput.createContents(result); - data = new GridData(GridData.FILL_BOTH); - c.setLayoutData(data); - - Button onlyNewChangesButton = new Button(result, SWT.CHECK); - onlyNewChangesButton.setText(Policy.bind("RefreshCompleteDialog.21")); //$NON-NLS-1$ - onlyNewChangesButton.setSelection(true); - onlyNewChangesButton.addSelectionListener(new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - if(((Button)e.getSource()).getSelection()) { - collector.setFilter(filter, new NullProgressMonitor()); - } else { - collector.setFilter(new FastSyncInfoFilter(), new NullProgressMonitor()); - } - } - public void widgetDefaultSelected(SelectionEvent e) { - } - }); - - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#createMainDialogArea(org.eclipse.swt.widgets.Composite) - */ - protected void createMainDialogArea(Composite parent) { - StringBuffer text = new StringBuffer(); - SyncInfo[] changes = event.getChanges(); - IResource[] resources = event.getResources(); - SyncInfoSet set = getSubscriberSyncInfoSet(); - if (! set.isEmpty()) { - String outgoing = Long.toString(set.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK)); - String incoming = Long.toString(set.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK)); - String conflicting = Long.toString(set.countFor(SyncInfo.CONFLICTING, SyncInfo.DIRECTION_MASK)); - text.append(Policy.bind("RefreshCompleteDialog.5", new Object[] {participant.getName(), outgoing, incoming, conflicting})); //$NON-NLS-1$ - createLabel(parent, text.toString(), 2); - } else { - text.append(Policy.bind("RefreshCompleteDialog.6")); //$NON-NLS-1$ - createLabel(parent, text.toString(), 2); - } - - dontShowAgainButton = new Button(parent, SWT.CHECK); - dontShowAgainButton.setText(Policy.bind("RefreshCompleteDialog.22")); //$NON-NLS-1$ - - initializeSettings(); - Dialog.applyDialogFont(parent); - } - - private void initializeSettings() { - if(dontShowAgainButton != null) { - dontShowAgainButton.setSelection(! TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCHRONIZING_COMPLETE_SHOW_DIALOG)); - } - } - - protected SyncInfoSet getSubscriberSyncInfoSet() { - return participant.getSubscriberSyncInfoCollector().getSubscriberSyncInfoSet(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.window.Window#getInitialSize() - */ - protected Point getInitialSize() { - int width, height; - try { - height = settings.getInt(HEIGHT_KEY); - width = settings.getInt(WIDTH_KEY); - } catch (NumberFormatException e) { - return super.getInitialSize(); - } - Point p = super.getInitialSize(); - return new Point(width, p.y); - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#includeCancelButton() - */ - protected boolean includeCancelButton() { - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#includeDetailsButton() - */ - protected boolean includeDetailsButton() { - return ! getSubscriberSyncInfoSet().isEmpty(); - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#includeErrorMessage() - */ - protected boolean includeErrorMessage() { - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.Dialog#okPressed() - */ - protected void okPressed() { - if(dontShowAgainButton != null) { - TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCHRONIZING_COMPLETE_SHOW_DIALOG, ! dontShowAgainButton.getSelection()); - } - TeamUIPlugin.getPlugin().savePluginPreferences(); - super.okPressed(); - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#updateEnablements() - */ - protected void updateEnablements() { - } - - private Label createLabel(Composite parent, String text, int columns) { - Label label = new Label(parent, SWT.WRAP); - label.setText(text); - GridData data = new GridData(); - data.horizontalSpan = columns; - data.widthHint = 375; - label.setLayoutData(data); - return label; - } - - private IResource[] getResources() { - SyncInfo[] changes = event.getChanges(); - IResource[] resources = new IResource[changes.length]; - for (int i = 0; i < changes.length; i++) { - SyncInfo info = changes[i]; - resources[i] = info.getLocal(); - } - return resources; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RemoteResourceTypedElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RemoteResourceTypedElement.java deleted file mode 100644 index 3210ffbaf..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RemoteResourceTypedElement.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize; - -import java.io.InputStream; - -import org.eclipse.compare.*; -import org.eclipse.core.resources.IStorage; -import org.eclipse.core.runtime.*; -import org.eclipse.swt.graphics.Image; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.variants.IResourceVariant; -import org.eclipse.team.internal.core.Assert; - -/** - * RemoteResourceTypedElement - */ -public class RemoteResourceTypedElement extends BufferedContent implements ITypedElement, IEditableContent { - - private IResourceVariant remote; - private IStorage bufferedContents; - - /** - * Creates a new content buffer for the given team node. - */ - public RemoteResourceTypedElement(IResourceVariant remote) { - Assert.isNotNull(remote); - this.remote = remote; - } - - public Image getImage() { - return CompareUI.getImage(getType()); - } - - public String getName() { - return remote.getName(); - } - - public String getContentIdentifier() { - return remote.getContentIdentifier(); - } - - public String getType() { - if (remote.isContainer()) { - return ITypedElement.FOLDER_TYPE; - } - String name = getName(); - if (name != null) { - int index = name.lastIndexOf('.'); - if (index == -1) - return ""; //$NON-NLS-1$ - if (index == (name.length() - 1)) - return ""; //$NON-NLS-1$ - return name.substring(index + 1); - } - return ITypedElement.FOLDER_TYPE; - } - - /** - * Returns true if this object can be modified. - * If it returns <code>false</code> the other methods must not be called. - * - * @return <code>true</code> if this object can be modified. - */ - public boolean isEditable() { - return false; - } - - /** - * This is not the definitive API! - * This method is called on a parent to - * - add a child, - * - remove a child, - * - copy the contents of a child - * - * What to do is encoded in the two arguments as follows: - * add: child == null other != null - * remove: child != null other == null - * copy: child != null other != null - */ - public ITypedElement replace(ITypedElement child, ITypedElement other) { - return null; - } - - /* (non-Javadoc) - * @see BufferedContent#createStream() - */ - protected InputStream createStream() throws CoreException { - if(bufferedContents == null) { - cacheContents(new NullProgressMonitor()); - } - if (bufferedContents != null) { - return bufferedContents.getContents(); - } - return null; - } - - public IResourceVariant getRemote() { - return remote; - } - - /** - * Cache the contents for the remote resource in a local buffer - * @param monitor - */ - public void cacheContents(IProgressMonitor monitor) throws TeamException { - bufferedContents = remote.getStorage(monitor); - } - - /** - * Update the remote handle in this typed element. - * @param variant the new remote handle - */ - public void update(IResourceVariant variant) { - Assert.isNotNull(variant); - discardBuffer(); - remote = variant; - fireContentChanged(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java deleted file mode 100644 index 8e5e1e062..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java +++ /dev/null @@ -1,580 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize; - -import java.io.*; -import java.util.*; - -import org.eclipse.core.runtime.*; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.util.ListenerList; -import org.eclipse.swt.widgets.Display; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.ui.*; -import org.eclipse.team.internal.ui.registry.SynchronizeParticipantDescriptor; -import org.eclipse.team.internal.ui.registry.SynchronizeParticipantRegistry; -import org.eclipse.team.ui.ITeamUIConstants; -import org.eclipse.team.ui.synchronize.*; -import org.eclipse.ui.*; - -/** - * Manages the registered synchronize participants. It handles notification of - * participant lifecycles, creation of <code>static</code> participants, and - * the re-creation of persisted participants. - * - * @see ISynchronizeView - * @see ISynchronizeParticipant - * @since 3.0 - */ -public class SynchronizeManager implements ISynchronizeManager { - /** - * Synchronize participants listeners - */ - private ListenerList fListeners = null; - - /** - * List of registered synchronize view pages {String id -> List participant - * instances}} - */ - private Map synchronizeParticipants = Collections.synchronizedMap(new HashMap(10)); - private SynchronizeParticipantRegistry participantRegistry = new SynchronizeParticipantRegistry(); - - // change notification constants - private final static int ADDED = 1; - private final static int REMOVED = 2; - - // save context constants - private final static String CTX_PARTICIPANTS = "syncparticipants"; //$NON-NLS-1$ - private final static String CTX_PARTICIPANT = "participant"; //$NON-NLS-1$ - private final static String CTX_ID = "id"; //$NON-NLS-1$ - private final static String CTX_PARTICIPANT_DATA = "data"; //$NON-NLS-1$ - private final static String FILENAME = "syncParticipants.xml"; //$NON-NLS-1$ - - /** - * Notifies a participant listeners of additions or removals - */ - class SynchronizeViewPageNotifier implements ISafeRunnable { - - private ISynchronizeParticipantListener fListener; - private int fType; - private ISynchronizeParticipant[] fChanged; - - public void handleException(Throwable exception) { - TeamUIPlugin.log(IStatus.ERROR, Policy.bind("SynchronizeManager.7"), exception); //$NON-NLS-1$ - } - - public void run() throws Exception { - switch (fType) { - case ADDED : - fListener.participantsAdded(fChanged); - break; - case REMOVED : - fListener.participantsRemoved(fChanged); - break; - } - } - - /** - * Notifies the given listener of the adds/removes - * @param participants the participants that changed - * @param update the type of change - */ - public void notify(ISynchronizeParticipant[] participants, int update) { - if (fListeners == null) { - return; - } - fChanged = participants; - fType = update; - Object[] copiedListeners = fListeners.getListeners(); - for (int i = 0; i < copiedListeners.length; i++) { - fListener = (ISynchronizeParticipantListener) copiedListeners[i]; - Platform.run(this); - } - fChanged = null; - fListener = null; - } - } - - /** - * Represents a paticipant instance and allows lazy initialization of the instance - * only when the participant is required. - */ - static class ParticipantInstance { - private ISynchronizeParticipant participant; - private IMemento savedState; - private SynchronizeParticipantDescriptor descriptor; - - public ParticipantInstance(SynchronizeParticipantDescriptor descriptor, IMemento savedState) { - this.savedState = savedState; - this.descriptor = descriptor; - } - - public void setParticipant(ISynchronizeParticipant participant) { - this.participant = participant; - } - - public ISynchronizeParticipant getParticipant() throws TeamException { - if (participant == null) { - try { - participant = (ISynchronizeParticipant) TeamUIPlugin.createExtension(descriptor.getConfigurationElement(), SynchronizeParticipantDescriptor.ATT_CLASS); - participant.setInitializationData(descriptor.getConfigurationElement(), null, null); - participant.init(savedState); - } catch (PartInitException e2) { - participant = null; - throw new TeamException(Policy.bind("SynchronizeManager.11"), e2); //$NON-NLS-1$ - } catch (CoreException e) { - participant = null; - throw TeamException.asTeamException(e); - } - } - return participant; - } - - public boolean isParticipantInitialized() { - return participant != null; - } - - public IMemento getSavedState() { - return savedState; - } - - public boolean equals(Object other) { - try { - if(other == this) return true; - if (other instanceof ISynchronizeParticipant) { - return other == this.getParticipant(); - } else if(other instanceof ParticipantInstance) { - return ((ParticipantInstance)other).getParticipant() == this.getParticipant(); - } - return false; - } catch (TeamException e) { - return false; - } - } - - public void dispose() { - if(participant != null) { - participant.dispose(); - } - } - - public String getId() { - return descriptor.getId(); - } - } - - public SynchronizeManager() { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.team.ui.sync.ISynchronizeManager#addSynchronizeParticipantListener(org.eclipse.team.ui.sync.ISynchronizeParticipantListener) - */ - public void addSynchronizeParticipantListener(ISynchronizeParticipantListener listener) { - if (fListeners == null) { - fListeners = new ListenerList(5); - } - fListeners.add(listener); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.team.ui.sync.ISynchronizeManager#removeSynchronizeParticipantListener(org.eclipse.team.ui.sync.ISynchronizeParticipantListener) - */ - public void removeSynchronizeParticipantListener(ISynchronizeParticipantListener listener) { - if (fListeners != null) { - fListeners.remove(listener); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.team.ui.synchronize.ISynchronizeManager#getParticipantDescriptor(java.lang.String) - */ - public ISynchronizeParticipantDescriptor getParticipantDescriptor(String id) { - return participantRegistry.find(id); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.team.ui.sync.ISynchronizeManager#addSynchronizeParticipants(org.eclipse.team.ui.sync.ISynchronizeParticipant[]) - */ - public synchronized void addSynchronizeParticipants(ISynchronizeParticipant[] participants) { - List added = new ArrayList(participants.length); - for (int i = 0; i < participants.length; i++) { - ISynchronizeParticipant participant = participants[i]; - ParticipantInstance instance = new ParticipantInstance(participantRegistry.find(participant.getId()), null /* no saved state */); - instance.setParticipant(participant); - addParticipant(instance); - try { - participant.init(null); - } catch (PartInitException e) { - TeamUIPlugin.log(IStatus.ERROR, Policy.bind("SynchronizeManager.13"), e); //$NON-NLS-1$ - continue; - } - added.add(participant); - } - if (!added.isEmpty()) { - saveState(); - fireUpdate((ISynchronizeParticipant[]) added.toArray(new ISynchronizeParticipant[added.size()]), ADDED); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.team.ui.sync.ISynchronizeManager#removeSynchronizeParticipants(org.eclipse.team.ui.sync.ISynchronizeParticipant[]) - */ - public synchronized void removeSynchronizeParticipants(ISynchronizeParticipant[] participants) { - List removed = new ArrayList(participants.length); - for (int i = 0; i < participants.length; i++) { - ISynchronizeParticipant participant = participants[i]; - if (removeParticipant(participant)) { - removed.add(participant); - } - } - if (!removed.isEmpty()) { - saveState(); - fireUpdate((ISynchronizeParticipant[]) removed.toArray(new ISynchronizeParticipant[removed.size()]), REMOVED); - for (Iterator it = removed.iterator(); it.hasNext(); ) { - ISynchronizeParticipant participant = (ISynchronizeParticipant) it.next(); - participant.dispose(); - } - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.team.ui.sync.ISynchronizeManager#getSynchronizeParticipants() - */ - public synchronized ISynchronizeParticipant[] getSynchronizeParticipants() { - List participants = new ArrayList(); - for (Iterator it = synchronizeParticipants.keySet().iterator(); it.hasNext(); ) { - String id = (String) it.next(); - ISynchronizeParticipant[] instances = find(id); - participants.addAll(Arrays.asList(instances)); - } - return (ISynchronizeParticipant[]) participants.toArray(new ISynchronizeParticipant[participants.size()]); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.team.ui.sync.ISynchronizeManager#find(java.lang.String) - */ - public ISynchronizeParticipant[] find(String id) { - List instances = (List) synchronizeParticipants.get(id); - if (instances == null) { - return new ISynchronizeParticipant[0]; - } - List participants = new ArrayList(instances.size()); - for (Iterator it = instances.iterator(); it.hasNext(); ) { - ParticipantInstance instance = (ParticipantInstance) it.next(); - ISynchronizeParticipant participant; - try { - participant = instance.getParticipant(); - if(participant != null) { - participants.add(participant); - } - } catch (TeamException e) { - // Participant instance is invalid - remove from list - it.remove(); - TeamUIPlugin.log(e); - } - } - return (ISynchronizeParticipant[]) participants.toArray(new ISynchronizeParticipant[participants.size()]); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.ISynchronizeManager#showSynchronizeViewInActivePage() - */ - public ISynchronizeView showSynchronizeViewInActivePage() { - IWorkbench workbench = TeamUIPlugin.getPlugin().getWorkbench(); - IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); - - boolean switchPerspectives = promptForPerspectiveSwitch(); - IWorkbenchPage activePage = null; - if(switchPerspectives) { - try { - String pId = TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCVIEW_DEFAULT_PERSPECTIVE); - activePage = workbench.showPerspective(pId, window); - } catch (WorkbenchException e) { - Utils.handleError(window.getShell(), e, Policy.bind("SynchronizeView.14"), e.getMessage()); //$NON-NLS-1$ - } - } - try { - if (activePage == null) { - activePage = TeamUIPlugin.getActivePage(); - if (activePage == null) - return null; - } - return (ISynchronizeView) activePage.showView(ISynchronizeView.VIEW_ID); - } catch (PartInitException pe) { - Utils.handleError(window.getShell(), pe, Policy.bind("SynchronizeView.16"), pe.getMessage()); //$NON-NLS-1$ - return null; - } - } - - /** - * Decides what action to take when switching perspectives and showing the synchronize view. Basically there are a - * set of user preferences that control how perspective switching. - */ - private boolean promptForPerspectiveSwitch() { - // Decide if a prompt is even required - String option = TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCHRONIZING_COMPLETE_PERSPECTIVE); - if(option.equals(IPreferenceIds.SYNCHRONIZING_COMPLETE_PERSPECTIVE_ALWAYS)) { - return true; - } else if(option.equals(IPreferenceIds.SYNCHRONIZING_COMPLETE_PERSPECTIVE_NEVER)) { - return false; - } - - // Otherwise determine if a prompt is required - IPerspectiveRegistry registry= PlatformUI.getWorkbench().getPerspectiveRegistry(); - String defaultSyncPerspective = TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCVIEW_DEFAULT_PERSPECTIVE); - String currentPerspective = null; - IPerspectiveDescriptor perspectiveDescriptor = registry.findPerspectiveWithId(defaultSyncPerspective); - IWorkbenchPage page = TeamUIPlugin.getActivePage(); - if(page != null) { - IPerspectiveDescriptor p = page.getPerspective(); - if(currentPerspective != null && currentPerspective.equals(defaultSyncPerspective)) { - perspectiveDescriptor = null; - } - } - - if(perspectiveDescriptor != null) { - String perspectiveName = perspectiveDescriptor.getLabel(); - - MessageDialog m = new MessageDialog(Display.getDefault().getActiveShell(), - Policy.bind("SynchronizeManager.27"), //$NON-NLS-1$ - null, // accept the default window icon - Policy.bind("SynchronizeManager.30", perspectiveDescriptor.getLabel()), //$NON-NLS-1$ - MessageDialog.QUESTION, - new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, Policy.bind("SynchronizeManager.28"), Policy.bind("SynchronizeManager.29")}, //$NON-NLS-1$ //$NON-NLS-2$ - 0); // yes is the default - - int result = m.open(); - switch (result) { - // yes - case 0 : - return true; - // no - case 1 : - return false; - // never - case 2 : - TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCHRONIZING_COMPLETE_PERSPECTIVE, IPreferenceIds.SYNCHRONIZING_COMPLETE_PERSPECTIVE_NEVER); - return false; - // always - case 3 : - TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCHRONIZING_COMPLETE_PERSPECTIVE, IPreferenceIds.SYNCHRONIZING_COMPLETE_PERSPECTIVE_ALWAYS); - return true; - } - } - return false; - } - - /** - * Creates the participant registry and restore any saved participants. - * Will also instantiate any static participants. - */ - public void init() { - try { - // Initialize the participant registry - reads all participant - // extension descriptions. - participantRegistry.readRegistry(Platform.getPluginRegistry(), TeamUIPlugin.ID, ITeamUIConstants.PT_SYNCPARTICIPANTS); - - // Instantiate and register any dynamic participants saved from a - // previous session. - restoreSavedParticipants(); - - // Instantiate and register any static participant that has not - // already been created. - initializeStaticParticipants(); - } catch (CoreException e) { - TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("SynchronizeManager.8"), e)); //$NON-NLS-1$ - } - } - - /** - * Allow participant instances to clean-up. - */ - public void dispose() { - for (Iterator it = synchronizeParticipants.keySet().iterator(); it.hasNext(); ) { - String id = (String) it.next(); - List participants = (List) synchronizeParticipants.get(id); - for (Iterator it2 = participants.iterator(); it2.hasNext(); ) { - ParticipantInstance instance = (ParticipantInstance) it2.next(); - instance.dispose(); - } - } - - // save state and settings for existing participants. - saveState(); - } - - private void initializeStaticParticipants() throws CoreException { - SynchronizeParticipantDescriptor[] desc = participantRegistry.getSynchronizeParticipants(); - List participants = new ArrayList(); - for (int i = 0; i < desc.length; i++) { - SynchronizeParticipantDescriptor descriptor = desc[i]; - if (descriptor.isStatic() && !synchronizeParticipants.containsKey(descriptor.getId())) { - addParticipant(new ParticipantInstance(descriptor, null /* no saved state */)); - } - } - } - - /** - * Restores participants that have been saved between sessions. - */ - private void restoreSavedParticipants() throws TeamException, CoreException { - File file = getStateFile(); - Reader reader; - try { - reader = new BufferedReader(new FileReader(file)); - } catch (FileNotFoundException e) { - return; - } - List participants = new ArrayList(); - IMemento memento = XMLMemento.createReadRoot(reader); - IMemento[] participantNodes = memento.getChildren(CTX_PARTICIPANT); - for (int i = 0; i < participantNodes.length; i++) { - IMemento memento2 = participantNodes[i]; - String id = memento2.getString(CTX_ID); - SynchronizeParticipantDescriptor desc = participantRegistry.find(id); - if (desc != null) { - IConfigurationElement cfgElement = desc.getConfigurationElement(); - addParticipant(new ParticipantInstance(desc, memento2.getChild(CTX_PARTICIPANT_DATA))); - } else { - TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("SynchronizeManager.9", id), null)); //$NON-NLS-1$ - } - } - } - - /** - * Saves a file containing the list of participant ids that are registered - * with this manager. Each initialized participant is also given the chance to save - * it's state. - */ - private void saveState() { - XMLMemento xmlMemento = XMLMemento.createWriteRoot(CTX_PARTICIPANTS); - List children = new ArrayList(); - for (Iterator it = synchronizeParticipants.keySet().iterator(); it.hasNext(); ) { - String id = (String) it.next(); - List participants = (List) synchronizeParticipants.get(id); - for (Iterator it2 = participants.iterator(); it2.hasNext(); ) { - ParticipantInstance instance = (ParticipantInstance) it2.next(); - - // Participants can opt out of being saved between sessions - if(instance.isParticipantInitialized()) { - ISynchronizeParticipant participant; - try { - participant = instance.getParticipant(); - } catch (TeamException e1) { - continue; - } - if(! participant.isPersistent()) continue; - } - - // Create the state placeholder for a participant - IMemento participantNode = xmlMemento.createChild(CTX_PARTICIPANT); - participantNode.putString(CTX_ID, instance.getId()); - IMemento participantData = participantNode.createChild(CTX_PARTICIPANT_DATA); - - // Allow the participant to save it's state. If the participant exists - // but isn't instantiated any loaded state will be re-saved. - if(instance.isParticipantInitialized()) { - ISynchronizeParticipant participant; - try { - participant = instance.getParticipant(); - } catch (TeamException e1) { - // Continue with the next participant instance. - continue; - } - participant.saveState(participantData); - } else { - IMemento savedState = instance.getSavedState(); - if(savedState != null) { - participantData.putMemento(savedState); - } - } - } - } - try { - Writer writer = new BufferedWriter(new FileWriter(getStateFile())); - try { - xmlMemento.save(writer); - } finally { - writer.close(); - } - } catch (IOException e) { - TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("SynchronizeManager.10"), e)); //$NON-NLS-1$ - } - } - - private File getStateFile() { - IPath pluginStateLocation = TeamUIPlugin.getPlugin().getStateLocation(); - return pluginStateLocation.append(FILENAME).toFile(); //$NON-NLS-1$ - } - - private synchronized void addParticipant(ParticipantInstance instance) { - String id = instance.getId(); - List instances = (List) synchronizeParticipants.get(id); - if (instances == null) { - instances = new ArrayList(2); - synchronizeParticipants.put(id, instances); - } - instances.add(instance); - } - - private synchronized boolean removeParticipant(ISynchronizeParticipant participant) { - boolean removed = false; - String id = participant.getId(); - List instances = (List) synchronizeParticipants.get(id); - if (instances != null) { - Iterator it = instances.iterator(); - ParticipantInstance instance = null; - while (it.hasNext()) { - ParticipantInstance tempInstance = (ParticipantInstance) it.next(); - try { - if(tempInstance.getParticipant() == participant) { - instance = tempInstance; - } - } catch (TeamException e) { - // Participant instance is invalid - remove from list - synchronizeParticipants.remove(tempInstance); - TeamUIPlugin.log(e); - } - } - if(instance != null) { - removed = instances.remove(instance); - if (instances.isEmpty()) { - synchronizeParticipants.remove(id); - } - } - } - return removed; - } - - /** - * Fires notification. - * @param participants participants added/removed - * @param type ADD or REMOVE - */ - private void fireUpdate(ISynchronizeParticipant[] participants, int type) { - new SynchronizeViewPageNotifier().notify(participants, type); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java deleted file mode 100644 index 576117caf..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java +++ /dev/null @@ -1,448 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize; - -import java.util.*; - -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.*; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.jface.viewers.*; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.widgets.Control; -import org.eclipse.team.core.ITeamStatus; -import org.eclipse.team.core.synchronize.*; -import org.eclipse.team.internal.core.Assert; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.ui.synchronize.viewers.*; -import org.eclipse.ui.progress.UIJob; - -/** - * This class is reponsible for creating and maintaining a presentation model of - * {@link SynchronizeModelElement} elements that can be shown in a viewer. The model - * is based on the synchronization information contained in the provided {@link SyncInfoSet}. - * <p> - * label updates (property propagation to parent nodes) - * sync change listener (changes, additions, removals, reset) - * batching busy updates - * </p> - * - * @see HierarchicalModelProvider - * @see CompressedFoldersModelProvider - * @since 3.0 - */ -public abstract class SynchronizeModelProvider implements ISyncInfoSetChangeListener, ISynchronizeModelProvider { - - // Flasg to indicate if tree control should be updated while - // building the model. - private boolean refreshViewer; - - protected Map resourceMap = Collections.synchronizedMap(new HashMap()); - - protected SynchronizeModelElement root; - - // The viewer this input is being displayed in - private StructuredViewer viewer; - - private Set pendingLabelUpdates = new HashSet(); - - private LabelUpdateJob labelUpdater = new LabelUpdateJob(); - - private IPropertyChangeListener listener = new IPropertyChangeListener() { - public void propertyChange(final PropertyChangeEvent event) { - if (event.getProperty() == SynchronizeModelElement.BUSY_PROPERTY) { - labelUpdater.add(event.getSource(), ((Boolean)event.getNewValue()).booleanValue()); - } - } - }; - - class LabelUpdateJob extends UIJob { - public static final int BATCH_WAIT_INCREMENT = 100; - Set nodes = new HashSet(); - public LabelUpdateJob() { - super(Policy.bind("HierarchicalModelProvider.0")); //$NON-NLS-1$ - setSystem(true); - } - public IStatus runInUIThread(IProgressMonitor monitor) { - Object[] updates; - synchronized(nodes) { - updates = nodes.toArray(new Object[nodes.size()]); - nodes.clear(); - } - if (canUpdateViewer()) { - StructuredViewer tree = getViewer(); - tree.update(updates, null); - } - schedule(BATCH_WAIT_INCREMENT); - return Status.OK_STATUS; - } - public void add(Object node, boolean isBusy) { - synchronized(nodes) { - nodes.add(node); - } - if (isBusy) { - schedule(BATCH_WAIT_INCREMENT); - } else { - // Wait when unbusying to give the events a chance to propogate through - // the collector - schedule(BATCH_WAIT_INCREMENT * 10); - } - } - public boolean shouldRun() { - return !nodes.isEmpty(); - } - } - - private SyncInfoSet set; - - /** - * Create an input based on the provide sync set. The input is not - * initialized until <code>prepareInput</code> is called. - * @param set - * the sync set used as the basis for the model created by this - * input. - */ - public SynchronizeModelProvider(SyncInfoSet set) { - this(new UnchangedResourceModelElement(null, ResourcesPlugin.getWorkspace().getRoot()) { - /* - * Override to ensure that the diff viewer will appear in CompareEditorInputs - */ - public boolean hasChildren() { - return true; - } - }, set); - } - - public SynchronizeModelProvider(SynchronizeModelElement parent, SyncInfoSet set) { - Assert.isNotNull(set); - Assert.isNotNull(parent); - this.root = parent; - this.set = set; - } - - public SyncInfoSet getSyncInfoSet() { - return set; - } - - /** - * Return the <code>AbstractTreeViewer</code> asociated with this content - * provider or <code>null</code> if the viewer is not of the proper type. - * @return - */ - public StructuredViewer getViewer() { - return viewer; - } - - public void setViewer(StructuredViewer viewer) { - Assert.isTrue(viewer instanceof AbstractTreeViewer); - this.viewer = (AbstractTreeViewer) viewer; - } - - /** - * Builds the viewer model based on the contents of the sync set. - */ - public SynchronizeModelElement prepareInput(IProgressMonitor monitor) { - // Connect to the sync set which will register us as a listener and give us a reset event - // in a background thread - getSyncInfoSet().connect(this, monitor); - return getModelRoot(); - } - - /** - * The provider can try and return a mapping for the provided object. Providers often use mappings - * to store the source of a logical element they have created. For example, when displaying resource - * based logical elements, a provider will cache the resource -> element mapping for quick retrieval - * of the element when resource based changes are made. - * - * @param object the object to query for a mapping - * @return an object created by this provider that would be shown in a viewer, or <code>null</code> - * if the provided object is not mapped by this provider. - */ - public Object getMapping(Object object) { - return resourceMap.get(object); - } - - /** - * Dispose of the builder - */ - public void dispose() { - resourceMap.clear(); - getSyncInfoSet().removeSyncSetChangedListener(this); - } - - /** - * Returns the input created by this controller or <code>null</code> if - * {@link #prepareInput(IProgressMonitor)} hasn't been called on this object yet. - * @return - */ - public SynchronizeModelElement getModelRoot() { - return root; - } - - public abstract ViewerSorter getViewerSorter(); - - /** - * Return the model object (i.e. an instance of <code>SyncInfoModelElement</code> - * or one of its subclasses) for the given IResource. - * @param resource - * the resource - * @return the <code>SyncInfoModelElement</code> for the given resource - */ - protected SynchronizeModelElement getModelObject(IResource resource) { - return (SynchronizeModelElement) resourceMap.get(resource); - } - - public void syncInfoChanged(final ISyncInfoSetChangeEvent event, IProgressMonitor monitor) { - if (! (event instanceof ISyncInfoTreeChangeEvent)) { - reset(); - } else { - final Control ctrl = getViewer().getControl(); - if (ctrl != null && !ctrl.isDisposed()) { - ctrl.getDisplay().syncExec(new Runnable() { - public void run() { - if (!ctrl.isDisposed()) { - BusyIndicator.showWhile(ctrl.getDisplay(), new Runnable() { - public void run() { - handleChanges((ISyncInfoTreeChangeEvent)event); - getModelRoot().fireChanges(); - } - }); - } - } - }); - } - } - } - - /** - * For each node create children based on the contents of - * @param node - * @return - */ - protected abstract IDiffElement[] buildModelObjects(SynchronizeModelElement node); - - protected abstract void doAdd(SynchronizeModelElement parent, SynchronizeModelElement element); - - protected abstract void doRemove(SynchronizeModelElement element); - - protected void associateDiffNode(SynchronizeModelElement node) { - IResource resource = node.getResource(); - if(resource != null) { - resourceMap.put(resource, node); - } - } - - protected void unassociateDiffNode(IResource resource) { - resourceMap.remove(resource); - } - - /** - * Handle the changes made to the viewer's <code>SyncInfoSet</code>. - * This method delegates the changes to the three methods <code>handleResourceChanges(ISyncInfoSetChangeEvent)</code>, - * <code>handleResourceRemovals(ISyncInfoSetChangeEvent)</code> and - * <code>handleResourceAdditions(ISyncInfoSetChangeEvent)</code>. - * @param event - * the event containing the changed resourcses. - */ - protected void handleChanges(ISyncInfoTreeChangeEvent event) { - StructuredViewer viewer = getViewer(); - try { - viewer.getControl().setRedraw(false); - handleResourceChanges(event); - handleResourceRemovals(event); - handleResourceAdditions(event); - firePendingLabelUpdates(); - } finally { - viewer.getControl().setRedraw(true); - } - } - - /** - * Update the viewer for the sync set additions in the provided event. This - * method is invoked by <code>handleChanges(ISyncInfoSetChangeEvent)</code>. - * Subclasses may override. - * @param event - */ - protected abstract void handleResourceAdditions(ISyncInfoTreeChangeEvent event); - - /** - * Update the viewer for the sync set changes in the provided event. This - * method is invoked by <code>handleChanges(ISyncInfoSetChangeEvent)</code>. - * Subclasses may override. - * @param event - */ - protected abstract void handleResourceChanges(ISyncInfoTreeChangeEvent event); - - protected boolean isConflicting(SynchronizeModelElement diffNode) { - return (diffNode.getKind() & SyncInfo.DIRECTION_MASK) == SyncInfo.CONFLICTING; - } - - /** - * Update the viewer for the sync set removals in the provided event. This - * method is invoked by <code>handleChanges(ISyncInfoSetChangeEvent)</code>. - * Subclasses may override. - * @param event - */ - protected abstract void handleResourceRemovals(ISyncInfoTreeChangeEvent event); - - protected void reset() { - try { - refreshViewer = false; - - // Clear existing model, but keep the root node - resourceMap.clear(); - clearModelObjects(getModelRoot()); - // remove all from tree viewer - IDiffElement[] elements = getModelRoot().getChildren(); - for (int i = 0; i < elements.length; i++) { - doRemove((SynchronizeModelElement)elements[i]); - } - - // Rebuild the model - associateDiffNode(getModelRoot()); - buildModelObjects(getModelRoot()); - - // Notify listeners that model has changed - getModelRoot().fireChanges(); - } finally { - refreshViewer = true; - } - TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() { - public void run() { - StructuredViewer viewer = getViewer(); - if (viewer != null && !viewer.getControl().isDisposed()) { - viewer.refresh(); - } - } - }); - } - - /** - * Remove any traces of the resource and any of it's descendants in the - * hiearchy defined by the content provider from the content provider and - * the viewer it is associated with. - * @param resource - */ - protected void removeFromViewer(IResource resource) { - SynchronizeModelElement node = getModelObject(resource); - if (node == null) return; - if (isConflicting(node)) { - setParentConflict(node, false); - } - clearModelObjects(node); - if (canUpdateViewer()) { - doRemove(node); - } - } - - /** - * Clear the model objects from the diff tree, cleaning up any cached state - * (such as resource to model object map). This method recurses deeply on - * the tree to allow the cleanup of any cached state for the children as - * well. - * @param node - * the root node - */ - protected void clearModelObjects(SynchronizeModelElement node) { - IDiffElement[] children = node.getChildren(); - for (int i = 0; i < children.length; i++) { - IDiffElement element = children[i]; - if (element instanceof SynchronizeModelElement) { - clearModelObjects((SynchronizeModelElement) element); - } - } - IResource resource = node.getResource(); - if (resource != null) { - unassociateDiffNode(resource); - } - IDiffContainer parent = node.getParent(); - if (parent != null) { - parent.removeToRoot(node); - } - } - - protected void addToViewer(SynchronizeModelElement node) { - associateDiffNode(node); - node.addPropertyChangeListener(listener); - if (isConflicting(node)) { - setParentConflict(node, true); - } - if (canUpdateViewer()) { - doAdd((SynchronizeModelElement)node.getParent(), node); - } - } - - /* (non-Javadoc) - * @see org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener#syncInfoSetReset(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor) - */ - public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) { - reset(); - } - - /* (non-Javadoc) - * @see org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener#syncInfoSetErrors(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.team.core.ITeamStatus[], org.eclipse.core.runtime.IProgressMonitor) - */ - public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) { - // When errors occur we currently don't process them. It may be possible to decorate - // elements in the model with errors, but currently we prefer to let ignore and except - // another listener to display them. - } - - /** - * Update the label of the given diff node. Diff nodes - * are accumulated and updated in a single call. - * @param diffNode the diff node to be updated - */ - protected void updateLabel(SynchronizeModelElement diffNode) { - pendingLabelUpdates.add(diffNode); - } - - /** - * @param tree - * @return - */ - private boolean canUpdateViewer() { - return refreshViewer && getViewer() != null; - } - - /** - * Forces the viewer to update the labels for parents whose children have - * changed during this round of sync set changes. - */ - protected void firePendingLabelUpdates() { - try { - if (canUpdateViewer()) { - StructuredViewer tree = getViewer(); - tree.update(pendingLabelUpdates.toArray(new Object[pendingLabelUpdates.size()]), null); - } - } finally { - pendingLabelUpdates.clear(); - } - } - - protected void setParentConflict(SynchronizeModelElement diffNode, boolean value) { - diffNode.setPropertyToRoot(SynchronizeModelElement.PROPAGATED_CONFLICT_PROPERTY, value); - updateParentLabels(diffNode); - } - - private void updateParentLabels(SynchronizeModelElement diffNode) { - updateLabel(diffNode); - while (diffNode.getParent() != null) { - diffNode = (SynchronizeModelElement)diffNode.getParent(); - updateLabel(diffNode); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java deleted file mode 100644 index e794f0106..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java +++ /dev/null @@ -1,336 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.jface.viewers.IBasicPropertyConstants; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.synchronize.actions.SynchronizePageDropDownAction; -import org.eclipse.team.ui.TeamUI; -import org.eclipse.team.ui.synchronize.*; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.part.*; - -/** - * Implements a Synchronize View that contains multiple synchronize participants. - */ -public class SynchronizeView extends PageBookView implements ISynchronizeView, ISynchronizeParticipantListener, IPropertyChangeListener { - - /** - * The participant being displayed, or <code>null</code> if none - */ - private ISynchronizeParticipant activeParticipant = null; - - /** - * Map of participants to dummy participant parts (used to close pages) - */ - private Map fParticipantToPart; - - /** - * Map of parts to participants - */ - private Map fPartToPage; - - /** - * Drop down action to switch between participants - */ - private SynchronizePageDropDownAction fPageDropDown; - - /** - * Preference key to save - */ - private static final String KEY_LAST_ACTIVE_PARTICIPANT = "lastactiveparticipant"; //$NON-NLS-1$ - private static final String KEY_SETTINGS_SECTION= "SynchronizeViewSettings"; //$NON-NLS-1$ - - /* (non-Javadoc) - * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent event) { - Object source = event.getSource(); - if (source instanceof ISynchronizeParticipant && event.getProperty().equals(IBasicPropertyConstants.P_TEXT)) { - if (source.equals(getParticipant())) { - updateTitle(); - } - } - - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart) - */ - public void partClosed(IWorkbenchPart part) { - super.partClosed(part); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.sync.ISynchronizeView#getParticipant() - */ - public ISynchronizeParticipant getParticipant() { - return activeParticipant; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.PageBookView#showPageRec(org.eclipse.ui.part.PageBookView.PageRec) - */ - protected void showPageRec(PageRec pageRec) { - super.showPageRec(pageRec); - activeParticipant = (ISynchronizeParticipant)fPartToPage.get(pageRec.part); - updateTitle(); - } - - /* - * Updates the view title based on the active participant - */ - protected void updateTitle() { - ISynchronizeParticipant page = getParticipant(); - if (page == null) { - setTitle(Policy.bind("SynchronizeView.1")); //$NON-NLS-1$ - } else { - setTitle(Policy.bind("SynchronizeView.2", page.getName())); //$NON-NLS-1$ - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.PageBookView#doDestroyPage(org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.part.PageBookView.PageRec) - */ - protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) { - IPage page = pageRecord.page; - page.dispose(); - pageRecord.dispose(); - ISynchronizeParticipant participant = (ISynchronizeParticipant) fPartToPage.get(part); - participant.removePropertyChangeListener(this); - // empty cross-reference cache - fPartToPage.remove(part); - fParticipantToPart.remove(participant); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.PageBookView#doCreatePage(org.eclipse.ui.IWorkbenchPart) - */ - protected PageRec doCreatePage(IWorkbenchPart dummyPart) { - SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart)dummyPart; - Object component = part.getPage(); - IPageBookViewPage page = null; - if(component instanceof ISynchronizeParticipant) { - ISynchronizeParticipant participant = (ISynchronizeParticipant)component; - participant.addPropertyChangeListener(this); - page = participant.createPage(this); - } else if(component instanceof IPageBookViewPage) { - page = (IPageBookViewPage)component; - } - - if(page != null) { - initPage(page); - page.createControl(getPageBook()); - PageRec rec = new PageRec(dummyPart, page); - return rec; - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.PageBookView#isImportant(org.eclipse.ui.IWorkbenchPart) - */ - protected boolean isImportant(IWorkbenchPart part) { - return part instanceof SynchronizeViewWorkbenchPart; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#dispose() - */ - public void dispose() { - super.dispose(); - - IDialogSettings workbenchSettings = TeamUIPlugin.getPlugin().getDialogSettings(); - if(activeParticipant != null) { - IDialogSettings section = workbenchSettings.getSection(KEY_SETTINGS_SECTION);//$NON-NLS-1$ - if (section == null) { - section = workbenchSettings.addNewSection(KEY_SETTINGS_SECTION); - } - section.put(KEY_LAST_ACTIVE_PARTICIPANT, activeParticipant.getId()); - } - - TeamUI.getSynchronizeManager().removeSynchronizeParticipantListener(this); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.PageBookView#createDefaultPage(org.eclipse.ui.part.PageBook) - */ - protected IPage createDefaultPage(PageBook book) { - MessagePage page = new MessagePage(); - page.createControl(getPageBook()); - initPage(page); - return page; - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.sync.ISynchronizeParticipantListener#participantsAdded(org.eclipse.team.ui.sync.ISynchronizeParticipant[]) - */ - public void participantsAdded(final ISynchronizeParticipant[] participants) { - for (int i = 0; i < participants.length; i++) { - if (isAvailable()) { - ISynchronizeParticipant participant = participants[i]; - SynchronizeViewWorkbenchPart part = new SynchronizeViewWorkbenchPart(participant, getSite()); - fParticipantToPart.put(participant, part); - fPartToPage.put(part, participant); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.sync.ISynchronizeParticipantListener#participantsRemoved(org.eclipse.team.ui.sync.ISynchronizeParticipant[]) - */ - public void participantsRemoved(final ISynchronizeParticipant[] consoles) { - if (isAvailable()) { - Runnable r = new Runnable() { - public void run() { - for (int i = 0; i < consoles.length; i++) { - if (isAvailable()) { - ISynchronizeParticipant console = consoles[i]; - SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart)fParticipantToPart.get(console); - if (part != null) { - partClosed(part); - } - if (getParticipant() == null) { - ISynchronizeParticipant[] available = TeamUI.getSynchronizeManager().getSynchronizeParticipants(); - if (available.length > 0) { - display(available[available.length - 1]); - } - } - } - } - } - }; - asyncExec(r); - } - } - - /** - * Constructs a synchronize view - */ - public SynchronizeView() { - super(); - fParticipantToPart = new HashMap(); - fPartToPage = new HashMap(); - updateTitle(); - } - - /** - * Create the default actions for the view. These will be shown regardless of the - * participant being displayed. - */ - protected void createActions() { - fPageDropDown = new SynchronizePageDropDownAction(this); - } - - /** - * Add the actions to the toolbar - * - * @param mgr toolbar manager - */ - protected void configureToolBar(IToolBarManager mgr) { - mgr.add(fPageDropDown); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.ISynchronizeView#display(org.eclipse.team.ui.synchronize.ISynchronizeParticipant) - */ - public void display(ISynchronizeParticipant participant) { - SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart)fParticipantToPart.get(participant); - if (part != null) { - partActivated(part); - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.PageBookView#getBootstrapPart() - */ - protected IWorkbenchPart getBootstrapPart() { - return null; - } - - /** - * Registers the given runnable with the display - * associated with this view's control, if any. - */ - public void asyncExec(Runnable r) { - if (isAvailable()) { - getPageBook().getDisplay().asyncExec(r); - } - } - - /** - * Creates this view's underlying viewer and actions. - * Hooks a pop-up menu to the underlying viewer's control, - * as well as a key listener. When the delete key is pressed, - * the <code>REMOVE_ACTION</code> is invoked. Hooks help to - * this view. Subclasses must implement the following methods - * which are called in the following order when a view is - * created:<ul> - * <li><code>createViewer(Composite)</code> - the context - * menu is hooked to the viewer's control.</li> - * <li><code>createActions()</code></li> - * <li><code>configureToolBar(IToolBarManager)</code></li> - * <li><code>getHelpContextId()</code></li> - * </ul> - * @see IWorkbenchPart#createPartControl(Composite) - */ - public void createPartControl(Composite parent) { - super.createPartControl(parent); - createActions(); - IToolBarManager tbm= getViewSite().getActionBars().getToolBarManager(); - configureToolBar(tbm); - updateForExistingParticipants(); - getViewSite().getActionBars().updateActionBars(); - updateTitle(); - } - - /** - * Initialize for existing participants - */ - private void updateForExistingParticipants() { - ISynchronizeManager manager = TeamUI.getSynchronizeManager(); - // create pages for consoles - ISynchronizeParticipant[] participants = manager.getSynchronizeParticipants(); - participantsAdded(participants); - // decide which participant to show on startup - if (participants.length > 0) { - ISynchronizeParticipant participantToSelect = participants[0]; - IDialogSettings workbenchSettings = TeamUIPlugin.getPlugin().getDialogSettings(); - IDialogSettings section = workbenchSettings.getSection(KEY_SETTINGS_SECTION);//$NON-NLS-1$ - if (section != null) { - String selectedParticipantId = section.get(KEY_LAST_ACTIVE_PARTICIPANT); - if(selectedParticipantId != null) { - ISynchronizeParticipant[] selectedParticipant = manager.find(selectedParticipantId); - if(selectedParticipant.length > 0) { - participantToSelect = selectedParticipant[0]; - } - } - } - display(participantToSelect); - } - - // add as a listener to update when new participants are added - manager.addSynchronizeParticipantListener(this); - } - - private boolean isAvailable() { - return getPageBook() != null && !getPageBook().isDisposed(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java deleted file mode 100644 index cc65485ff..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize; - -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.*; - -/** - * Fake part to use as keys in page book for synchronize participants - */ -public class SynchronizeViewWorkbenchPart implements IWorkbenchPart { - - private Object page = null; - private IWorkbenchPartSite site = null; - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object obj) { - return (obj instanceof SynchronizeViewWorkbenchPart) && - page.equals(((SynchronizeViewWorkbenchPart)obj).getPage()); - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return page.hashCode(); - } - - /** - * Constructs a part for the given participant that binds to the given - * site - */ - public SynchronizeViewWorkbenchPart(Object page, IWorkbenchPartSite site) { - this.page = page; - this.site = site; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#addPropertyListener(org.eclipse.ui.IPropertyListener) - */ - public void addPropertyListener(IPropertyListener listener) { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) - */ - public void createPartControl(Composite parent) { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#dispose() - */ - public void dispose() { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#getSite() - */ - public IWorkbenchPartSite getSite() { - return site; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#getTitle() - */ - public String getTitle() { - return ""; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#getTitleImage() - */ - public Image getTitleImage() { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#getTitleToolTip() - */ - public String getTitleToolTip() { - return ""; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#removePropertyListener(org.eclipse.ui.IPropertyListener) - */ - public void removePropertyListener(IPropertyListener listener) { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#setFocus() - */ - public void setFocus() { - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - public Object getAdapter(Class adapter) { - return null; - } - - /** - * Returns the participant associated with this part. - * - * @return participant associated with this part - */ - protected Object getPage() { - return page; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSynchronizingPerspective.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSynchronizingPerspective.java deleted file mode 100644 index 3387a7b4c..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSynchronizingPerspective.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize; - -import org.eclipse.ui.*; - -public class TeamSynchronizingPerspective implements IPerspectiveFactory { - - public final static String ID = "org.eclipse.team.ui.TeamSynchronizingPerspective"; //$NON-NLS-1$ - - /* (Non-javadoc) - * Method declared on IPerpsectiveFactory - */ - public void createInitialLayout(IPageLayout layout) { - defineActions(layout); - defineLayout(layout); - } - - /** - * Defines the initial actions for a page. - */ - public void defineActions(IPageLayout layout) { - - // Add "new wizards". - layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.project"); //$NON-NLS-1$ - layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder"); //$NON-NLS-1$ - layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file"); //$NON-NLS-1$ - - // Add "show views". - layout.addShowViewShortcut(SynchronizeView.VIEW_ID); - layout.addShowViewShortcut(IPageLayout.ID_RES_NAV); - layout.addShowViewShortcut(IPageLayout.ID_OUTLINE); - layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST); - layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW); - - layout.addActionSet("org.eclipse.team.ui.actionSet"); //$NON-NLS-1$ - } - - /** - * Defines the initial layout for a page. - */ - public void defineLayout(IPageLayout layout) { - String editorArea = layout.getEditorArea(); - IFolderLayout top = layout.createFolder("top", IPageLayout.LEFT, 0.25f, editorArea); //$NON-NLS-1$ - top.addView(SynchronizeView.VIEW_ID); - layout.setEditorAreaVisible(true); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ClearWorkingSetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ClearWorkingSetAction.java deleted file mode 100644 index 1d6e8f7b4..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ClearWorkingSetAction.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize.actions; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.util.Assert; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.internal.IHelpContextIds; -import org.eclipse.ui.internal.WorkbenchMessages; - -/** - * Clears the selected working set in the working set action group. - * - * @since 2.1 - */ -public class ClearWorkingSetAction extends Action { - private WorkingSetFilterActionGroup actionGroup; - - /** - * Creates a new instance of the receiver. - * - * @param actionGroup the action group this action is created in - */ - public ClearWorkingSetAction(WorkingSetFilterActionGroup actionGroup) { - super(WorkbenchMessages.getString("ClearWorkingSetAction.text")); //$NON-NLS-1$ - Assert.isNotNull(actionGroup); - setToolTipText(WorkbenchMessages.getString("ClearWorkingSetAction.toolTip")); //$NON-NLS-1$ - setEnabled(actionGroup.getWorkingSet() != null); - WorkbenchHelp.setHelp(this, IHelpContextIds.CLEAR_WORKING_SET_ACTION); - this.actionGroup = actionGroup; - } - /** - * Overrides method from Action - * - * @see org.eclipse.jface.Action#run - */ - public void run() { - actionGroup.setWorkingSet(null); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/EditWorkingSetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/EditWorkingSetAction.java deleted file mode 100644 index c9e1290ab..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/EditWorkingSetAction.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize.actions; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.util.Assert; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.*; -import org.eclipse.ui.dialogs.IWorkingSetEditWizard; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.internal.IHelpContextIds; -import org.eclipse.ui.internal.WorkbenchMessages; - -/** - * Displays an IWorkingSetEditWizard for editing a working set. - * - * @since 2.1 - */ -public class EditWorkingSetAction extends Action { - private Shell shell; - private WorkingSetFilterActionGroup actionGroup; - - /** - * Creates a new instance of the receiver. - * - * @param actionGroup the action group this action is created in - */ - public EditWorkingSetAction(WorkingSetFilterActionGroup actionGroup, Shell shell) { - super(WorkbenchMessages.getString("EditWorkingSetAction.text")); //$NON-NLS-1$ - Assert.isNotNull(actionGroup); - setToolTipText(WorkbenchMessages.getString("EditWorkingSetAction.toolTip")); //$NON-NLS-1$ - this.shell = shell; - this.actionGroup = actionGroup; - WorkbenchHelp.setHelp(this, IHelpContextIds.EDIT_WORKING_SET_ACTION); - } - /** - * Overrides method from Action - * - * @see org.eclipse.jface.Action#run - */ - public void run() { - IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager(); - IWorkingSet workingSet = actionGroup.getWorkingSet(); - - if (workingSet == null) { - setEnabled(false); - return; - } - IWorkingSetEditWizard wizard = manager.createWorkingSetEditWizard(workingSet); - if (wizard == null) { - String title = WorkbenchMessages.getString("EditWorkingSetAction.error.nowizard.title"); //$NON-NLS-1$ - String message = WorkbenchMessages.getString("EditWorkingSetAction.error.nowizard.message"); //$NON-NLS-1$ - MessageDialog.openError(shell, title, message); - return; - } - WizardDialog dialog = new WizardDialog(shell, wizard); - dialog.create(); - if (dialog.open() == WizardDialog.OK) - actionGroup.setWorkingSet(wizard.getSelection()); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ExpandAllAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ExpandAllAction.java deleted file mode 100644 index 0d305b152..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ExpandAllAction.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize.actions; - -import java.util.Iterator; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.*; - - -public class ExpandAllAction extends Action implements ISelectionChangedListener { - - private final AbstractTreeViewer viewer; - - public ExpandAllAction(AbstractTreeViewer viewer) { - this.viewer = viewer; - viewer.addSelectionChangedListener(this); - } - public void run() { - expandAllFromSelection(); - } - - protected void expandAllFromSelection() { - AbstractTreeViewer tree = viewer; - if (tree == null) return; - ISelection selection = tree.getSelection(); - if(! selection.isEmpty()) { - Iterator elements = ((IStructuredSelection)selection).iterator(); - while (elements.hasNext()) { - Object next = elements.next(); - tree.expandToLevel(next, AbstractTreeViewer.ALL_LEVELS); - } - } - } - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) - */ - public void selectionChanged(SelectionChangedEvent event) { - ISelection selection = event.getSelection(); - if (selection instanceof IStructuredSelection) { - IStructuredSelection ss = (IStructuredSelection)selection; - setEnabled(!ss.isEmpty()); - return; - } - setEnabled(false); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java deleted file mode 100644 index ce43c6c6d..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java +++ /dev/null @@ -1,186 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize.actions; - -import org.eclipse.jface.action.*; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.*; -import org.eclipse.team.internal.ui.*; -import org.eclipse.team.internal.ui.wizards.GlobalSynchronizeWizard; -import org.eclipse.team.ui.TeamUI; -import org.eclipse.team.ui.synchronize.ISynchronizeParticipant; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWindowPulldownDelegate; - -/** - * A global refresh action that allows the user to select the participant to refresh - * or the default action is to refresh the last selected participant. Participants are - * only listed if they support - * <p> - * This action is normally associated with the Team action set and is enabled by default - * in the Team Synchronizing perspective. - * </p> - * @since 3.0 - */ -public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbenchWindowPulldownDelegate { - - public final static String NO_DEFAULT_PARTICPANT = "none"; //$NON-NLS-1$ - private Menu fMenu; - private Action synchronizeAction; - private IWorkbenchWindow window; - - static class SynchronizeWizardDialog extends WizardDialog { - SynchronizeWizardDialog(Shell parent, IWizard wizard) { - super(parent, wizard); - setShellStyle(getShellStyle()); - setMinimumPageSize(500, 300); - } - } - - class RefreshParticipantAction extends Action { - private ISynchronizeParticipant participant; - - public void run() { - TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT, participant.getId()); - IWizard wizard = participant.createSynchronizeWizard(); - SynchronizeWizardDialog dialog = new SynchronizeWizardDialog(window.getShell(), wizard); - dialog.open(); - GlobalRefreshAction.this.updateTooltipMessage(); - } - - public RefreshParticipantAction(int prefix, ISynchronizeParticipant participant) { - super("&" + prefix + " " + participant.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - this.participant = participant; - setImageDescriptor(participant.getImageDescriptor()); - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.texteditor.IUpdate#update() - */ - public void update() { - ISynchronizeParticipant[] pages = TeamUI.getSynchronizeManager().getSynchronizeParticipants(); - setEnabled(pages.length >= 1); - } - - public GlobalRefreshAction() { - Utils.initAction(this, "action.refreshSubscriber."); //$NON-NLS-1$ - synchronizeAction = new Action(Policy.bind("GlobalRefreshAction.4")) { //$NON-NLS-1$ - public void run() { - IWizard wizard = new GlobalSynchronizeWizard(); - SynchronizeWizardDialog dialog = new SynchronizeWizardDialog(window.getShell(), wizard); - dialog.open(); - } - }; - setMenuCreator(this); - setToolTipText("this is a test"); - //updateTooltipMessage(); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jface.action.IMenuCreator#dispose() - */ - public void dispose() { - if (fMenu != null) { - fMenu.dispose(); - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu) - */ - public Menu getMenu(Menu parent) { - return null; - } - - /* - * (non-Javadoc) - * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control) - */ - public Menu getMenu(Control parent) { - if (fMenu != null) { - fMenu.dispose(); - } - fMenu = new Menu(parent); - ISynchronizeParticipant[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants(); - for (int i = 0; i < participants.length; i++) { - ISynchronizeParticipant description = participants[i]; - if (description.doesSupportSynchronize()) { - Action action = new RefreshParticipantAction(i + 1, description); - addActionToMenu(fMenu, action); - } - } - addMenuSeparator(); - addActionToMenu(fMenu, synchronizeAction); - return fMenu; - } - - protected void addActionToMenu(Menu parent, Action action) { - ActionContributionItem item = new ActionContributionItem(action); - item.fill(parent, -1); - } - - protected void addMenuSeparator() { - new MenuItem(fMenu, SWT.SEPARATOR); - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow) - */ - public void init(IWorkbenchWindow window) { - this.window = window; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) { - String id = TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT); - IWizard wizard = new GlobalSynchronizeWizard(); - if(! id.equals(NO_DEFAULT_PARTICPANT)) { - ISynchronizeParticipant[] participants = TeamUI.getSynchronizeManager().find(id); - if(participants.length > 0) { - wizard = participants[0].createSynchronizeWizard(); - } - } - SynchronizeWizardDialog dialog = new SynchronizeWizardDialog(window.getShell(), wizard); - dialog.open(); - updateTooltipMessage(); - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, - * org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged(IAction action, ISelection selection) { - } - - protected void updateTooltipMessage() { - String id = TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT); - if(! id.equals(NO_DEFAULT_PARTICPANT)) { - ISynchronizeParticipant[] participants = TeamUI.getSynchronizeManager().find(id); - if(participants.length > 0) { - setToolTipText(Policy.bind("GlobalRefreshAction.5", participants[0].getName())); //$NON-NLS-1$ - } - } else { - setToolTipText(Policy.bind("GlobalRefreshAction.4")); //$NON-NLS-1$ - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java deleted file mode 100644 index 6da1e0fcb..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize.actions; - -import org.eclipse.compare.CompareEditorInput; -import org.eclipse.compare.ICompareNavigator; -import org.eclipse.compare.internal.INavigatable; -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.team.core.synchronize.SyncInfo; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.team.ui.synchronize.ISynchronizeView; -import org.eclipse.team.ui.synchronize.viewers.SyncInfoModelElement; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IKeyBindingService; -import org.eclipse.ui.actions.ActionFactory; - -/** - * Action to navigate the changes shown in the Synchronize View. This - * will coordinate change browsing between the view and the compare - * editors. - * - * @since 3.0 - */ -public class NavigateAction extends Action { - private final boolean next; - private ISynchronizeView view; - private INavigatable navigator; - - /** - * Direction to navigate - */ - final public static int NEXT = 1; - final public static int PREVIOUS = 2; - - public NavigateAction(ISynchronizeView view, INavigatable navigator, boolean next) { - this.navigator = navigator; - this.view = view; - this.next = next; - - IKeyBindingService kbs = view.getSite().getKeyBindingService(); - if(next) { - Utils.initAction(this, "action.navigateNext."); //$NON-NLS-1$ - view.getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.NEXT.getId(), this); - } else { - Utils.initAction(this, "action.navigatePrevious."); //$NON-NLS-1$ - view.getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.PREVIOUS.getId(), this); - } - } - - public void run() { - navigate(); - } - - private void navigate() { - SyncInfo info = getSyncInfoFromSelection(); - if(info == null) { - if(navigator.gotoDifference(next)) { - return; - } else { - info = getSyncInfoFromSelection(); - if(info == null) return; - } - } - - if(info.getLocal().getType() != IResource.FILE) { - if(! navigator.gotoDifference(next)) { - info = getSyncInfoFromSelection(); - OpenInCompareAction.openCompareEditor(view, view.getParticipant(), info, true /* keep focus */); - } - return; - } - - IEditorPart editor = OpenInCompareAction.findOpenCompareEditor(view.getSite(), info.getLocal()); - boolean atEnd = false; - CompareEditorInput input; - ICompareNavigator navigator; - - if(editor != null) { - // if an existing editor is open on the current selection, use it - input = (CompareEditorInput)editor.getEditorInput(); - navigator = (ICompareNavigator)input.getAdapter(ICompareNavigator.class); - if(navigator != null) { - if(navigator.selectChange(next)) { - if(! this.navigator.gotoDifference(next)) { - info = getSyncInfoFromSelection(); - OpenInCompareAction.openCompareEditor(view, view.getParticipant(), info, true /* keep focus */); - } - } - } - } else { - // otherwise, select the next change and open a compare editor which will automatically - // show the first change. - OpenInCompareAction.openCompareEditor(view, view.getParticipant(), info, true /* keep focus */); - } - } - - private SyncInfo getSyncInfoFromSelection() { - IStructuredSelection selection = (IStructuredSelection)view.getSite().getPage().getSelection(); - if(selection == null) return null; - Object obj = selection.getFirstElement(); - if (obj instanceof SyncInfoModelElement) { - return ((SyncInfoModelElement) obj).getSyncInfo(); - } else { - return null; - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java deleted file mode 100644 index 8564d3d8e..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize.actions; - -import java.util.*; - -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.actions.OpenFileAction; - -public class OpenFileInSystemEditorAction extends OpenFileAction { - - public OpenFileInSystemEditorAction(IWorkbenchPage page) { - super(page); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.actions.SelectionListenerAction#getSelectedResources() - */ - protected List getSelectedResources() { - IStructuredSelection selection = getStructuredSelection(); - IResource[] resources = Utils.getResources(selection.toArray()); - return Arrays.asList(resources); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.actions.SelectionListenerAction#getSelectedNonResources() - */ - protected List getSelectedNonResources() { - return Collections.EMPTY_LIST; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java deleted file mode 100644 index 0a99a1f94..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java +++ /dev/null @@ -1,162 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize.actions; - -import org.eclipse.compare.CompareUI; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.team.core.synchronize.SyncInfo; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.team.ui.synchronize.ISynchronizeParticipant; -import org.eclipse.team.ui.synchronize.ISynchronizeView; -import org.eclipse.team.ui.synchronize.viewers.SyncInfoCompareInput; -import org.eclipse.team.ui.synchronize.viewers.SyncInfoModelElement; -import org.eclipse.ui.*; - -/** - * Action to open a compare editor from a SyncInfo object. - * - * @see SyncInfoCompareInput - * @since 3.0 - */ -public class OpenInCompareAction extends Action { - - private ISynchronizeView view; - private ISynchronizeParticipant participant; - - public OpenInCompareAction(ISynchronizeView view, ISynchronizeParticipant participant) { - this.participant = participant; - this.view = view; - Utils.initAction(this, "action.openInCompareEditor."); //$NON-NLS-1$ - } - - public void run() { - ISelection selection = view.getSite().getPage().getSelection(); - if(selection instanceof IStructuredSelection) { - Object obj = ((IStructuredSelection) selection).getFirstElement(); - if (obj instanceof SyncInfoModelElement) { - SyncInfo info = ((SyncInfoModelElement) obj).getSyncInfo(); - if (info != null) { - openCompareEditor(view, participant, info, true); - } - } - } - } - - public static SyncInfoCompareInput openCompareEditor(IWorkbenchPart page, ISynchronizeParticipant participant, SyncInfo info, boolean keepFocus) { - SyncInfoCompareInput input = getCompareInput(participant, info); - if(input != null) { - IWorkbenchPage wpage = page.getSite().getPage(); - IEditorPart editor = findReusableCompareEditor(wpage); - - if(editor != null) { - IEditorInput otherInput = editor.getEditorInput(); - if(otherInput instanceof SyncInfoCompareInput && otherInput.equals(input)) { - // simply provide focus to editor - wpage.activate(editor); - } else { - // if editor is currently not open on that input either re-use existing - if(editor != null && editor instanceof IReusableEditor) { - CompareUI.reuseCompareEditor(input, (IReusableEditor)editor); - wpage.activate(editor); - } - } - } else { - CompareUI.openCompareEditor(input); - editor = page.getSite().getPage().getActiveEditor(); - } - - if(editor != null) { - input.setCompareEditor(editor); - } - - if(keepFocus) { - wpage.activate(page); - } - return input; - } - return null; - } - - /** - * Returns a SyncInfoCompareInput instance for the current selection. - */ - private static SyncInfoCompareInput getCompareInput(ISynchronizeParticipant participant, SyncInfo info) { - if (info != null && info.getLocal() instanceof IFile) { - return new SyncInfoCompareInput(participant.getName(), info); - } - return null; - } - - /** - * Returns an editor that can be re-used. An open compare editor that - * has un-saved changes cannot be re-used. - */ - public static IEditorPart findReusableCompareEditor(IWorkbenchPage page) { - IEditorReference[] editorRefs = page.getEditorReferences(); - - for (int i = 0; i < editorRefs.length; i++) { - IEditorPart part = editorRefs[i].getEditor(true); - if(part != null && part.getEditorInput() instanceof SyncInfoCompareInput) { - if(! part.isDirty()) { - return part; - } - } - } - return null; - } - - /** - * Close a compare editor that is opened on the given IResource. - * - * @param site the view site in which to close the editors - * @param resource the resource to use to find the compare editor - */ - public static void closeCompareEditorFor(final IWorkbenchPartSite site, final IResource resource) { - site.getShell().getDisplay().asyncExec(new Runnable() { - public void run() { - IEditorPart editor = findOpenCompareEditor(site, resource); - if(editor != null) { - site.getPage().closeEditor(editor, true /*save changes if required */); - } - } - }); - } - - /** - * Returns an editor handle if a SyncInfoCompareInput compare editor is opened on - * the given IResource. - * - * @param site the view site in which to search for editors - * @param resource the resource to use to find the compare editor - * @return an editor handle if found and <code>null</code> otherwise - */ - public static IEditorPart findOpenCompareEditor(IWorkbenchPartSite site, IResource resource) { - IWorkbenchPage page = site.getPage(); - IEditorReference[] editorRefs = page.getEditorReferences(); - for (int i = 0; i < editorRefs.length; i++) { - final IEditorPart part = editorRefs[i].getEditor(false /* don't restore editor */); - if(part != null) { - IEditorInput input = part.getEditorInput(); - if(part != null && input instanceof SyncInfoCompareInput) { - SyncInfo inputInfo = ((SyncInfoCompareInput)input).getSyncInfo(); - if(inputInfo.getLocal().equals(resource)) { - return part; - } - } - } - } - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java deleted file mode 100644 index 1d1fd9cfa..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize.actions; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.team.ui.synchronize.ISynchronizeParticipant; -import org.eclipse.team.ui.synchronize.ISynchronizeView; -import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipantPage; -import org.eclipse.ui.actions.ActionGroup; -import org.eclipse.ui.actions.OpenWithMenu; -import org.eclipse.ui.views.navigator.ResourceNavigatorMessages; - -/** - * This is the action group for the open actions. It contains open - * actions for - */ -public class OpenWithActionGroup extends ActionGroup { - - private OpenFileInSystemEditorAction openFileAction; - private OpenInCompareAction openInCompareAction; - private SubscriberParticipantPage page; - private ISynchronizeView view; - private ISynchronizeParticipant participant; - - public OpenWithActionGroup(ISynchronizeView part, ISynchronizeParticipant participant) { - this.participant = participant; - this.view = part; - makeActions(); - } - - protected void makeActions() { - openFileAction = new OpenFileInSystemEditorAction(view.getSite().getPage()); - openInCompareAction = new OpenInCompareAction(view, participant); - } - - public void fillContextMenu(IMenuManager menu) { - fillOpenWithMenu(menu, (IStructuredSelection)view.getSite().getPage().getSelection()); - } - - /** - * Adds the OpenWith submenu to the context menu. - * - * @param menu the context menu - * @param selection the current selection - */ - private void fillOpenWithMenu(IMenuManager menu, IStructuredSelection selection) { - - // Only supported if exactly one file is selected. - if (selection == null || selection.size() != 1) - return; - Object element = selection.getFirstElement(); - IResource resources[] = Utils.getResources(new Object[] {element}); - IResource resource = null; - if(resources.length == 0) { - return; - } - resource = resources[0]; - - if(resource.getType() != IResource.FILE) return; - - menu.add(openInCompareAction); - - if(!((resource.exists()))) { - return; - } - - openFileAction.selectionChanged(selection); - menu.add(openFileAction); - - MenuManager submenu = - new MenuManager(ResourceNavigatorMessages.getString("ResourceNavigator.openWith")); //$NON-NLS-1$ - submenu.add(new OpenWithMenu(view.getSite().getPage(), (IFile) resource)); - menu.add(submenu); - } - - /** - * Runs the default action (open file). - */ - public void runDefaultAction(IStructuredSelection selection) { - Object element = selection.getFirstElement(); - if (element instanceof IFile) { - openFileAction.selectionChanged(selection); - openFileAction.run(); - } - } - - public void openInCompareEditor() { - openInCompareAction.run(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java deleted file mode 100644 index 63ba14ed7..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize.actions; - -import java.util.Iterator; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.team.ui.synchronize.ISynchronizeView; -import org.eclipse.ui.*; -import org.eclipse.ui.actions.*; - -/** - * This action group is modeled after the class of the same name in - * the org.eclipse.ui.workbench plugin. We couldn't reuse that class - * because of a hard dependency on the navigator. - */ -public class RefactorActionGroup extends ActionGroup { - - private DeleteResourceAction deleteAction; - private MoveResourceAction moveAction; - private RenameResourceAction renameAction; - private TextActionHandler textActionHandler; - private ISynchronizeView view; - - public RefactorActionGroup(ISynchronizeView view) { - this.view = view; - makeActions(); - } - - public void fillContextMenu(IMenuManager parentMenu) { - IStructuredSelection selection = getSelection(); - - boolean anyResourceSelected = - !selection.isEmpty() - && allResourcesAreOfType( - selection, - IResource.PROJECT | IResource.FOLDER | IResource.FILE); - - MenuManager menu = new MenuManager(Policy.bind("RefactorActionGroup.0")); //$NON-NLS-1$ - IStructuredSelection convertedSelection = convertSelection(selection); - - if (anyResourceSelected) { - deleteAction.selectionChanged(convertedSelection); - menu.add(deleteAction); - moveAction.selectionChanged(convertedSelection); - menu.add(moveAction); - renameAction.selectionChanged(convertedSelection); - menu.add(renameAction); - } - parentMenu.add(menu); - } - - private IStructuredSelection convertSelection(IStructuredSelection selection) { - return new StructuredSelection(Utils.getResources(selection.toArray())); - } - - public void fillActionBars(IActionBars actionBars) { - textActionHandler = new TextActionHandler(actionBars); // hooks handlers - textActionHandler.setDeleteAction(deleteAction); - renameAction.setTextActionHandler(textActionHandler); - } - - protected void makeActions() { - // Get the key binding service for registering actions with commands. - final IWorkbenchPartSite site = view.getSite(); - final IKeyBindingService keyBindingService = site.getKeyBindingService(); - - Shell shell = site.getShell(); - ISharedImages images = PlatformUI.getWorkbench().getSharedImages(); - - moveAction = new MoveResourceAction(shell); - renameAction = new RenameResourceAction(shell); - - deleteAction = new DeleteResourceAction(shell); - deleteAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED)); - deleteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)); - deleteAction.setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_HOVER)); - /* NOTE: This is defined in "plugin.xml" in "org.eclipse.ui". It is - * only publicly declared in code in IWorkbenchActionDefinitionIds in - * "org.eclipse.ui.workbench.texteditor". - */ - deleteAction.setActionDefinitionId("org.eclipse.ui.edit.delete"); //$NON-NLS-1$ - keyBindingService.registerAction(deleteAction); - } - - public void updateActionBars() { - IStructuredSelection selection = getSelection(); - deleteAction.selectionChanged(selection); - moveAction.selectionChanged(selection); - renameAction.selectionChanged(selection); - } - - private IStructuredSelection getSelection() { - return (IStructuredSelection)view.getSite().getPage().getSelection(); - } - - private boolean allResourcesAreOfType(IStructuredSelection selection, int resourceMask) { - Iterator resources = selection.iterator(); - while (resources.hasNext()) { - Object next = resources.next(); - IResource resource = null; - if (next instanceof IResource) { - resource = (IResource)next; - } else if (next instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable)next; - resource = (IResource)adaptable.getAdapter(IResource.class); - } - if(resource == null) { - IResource[] r = Utils.getResources(new Object[] {next}); - if(r.length == 1) { - resource = r[0]; - } - } - if (resource == null || (resource.getType() & resourceMask) == 0) { - return false; - } - } - return true; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java deleted file mode 100644 index 1ddf87c28..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize.actions; - -import org.eclipse.jface.action.Action; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.team.ui.TeamUI; -import org.eclipse.team.ui.synchronize.ISynchronizeParticipant; - -/** - * Action to remove the given participant from the synchronize manager. - * @since 3.0 - */ -public class RemoveSynchronizeParticipantAction extends Action { - private ISynchronizeParticipant participant; - - /** - * Creates the action to remove the participant from the synchronize - * manager. - * @param participant the participant to remove from the synchronize - * manager. - */ - public RemoveSynchronizeParticipantAction(ISynchronizeParticipant participant) { - this.participant = participant; - Utils.initAction(this, "action.removePage.", Policy.getBundle()); //$NON-NLS-1$ - } - - public void run() { - TeamUI.getSynchronizeManager().removeSynchronizeParticipants( - new ISynchronizeParticipant[] {participant}); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SelectWorkingSetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SelectWorkingSetAction.java deleted file mode 100644 index a9a26a591..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SelectWorkingSetAction.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize.actions; - - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.util.Assert; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.*; -import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.internal.IHelpContextIds; -import org.eclipse.ui.internal.WorkbenchMessages; - -/** - * Displays an IWorkingSetSelectionDialog and sets the selected - * working set in the action group. - * - * @since 2.1 - */ -public class SelectWorkingSetAction extends Action { - private Shell shell; - private WorkingSetFilterActionGroup actionGroup; - - /** - * Creates a new instance of the receiver. - * - * @param actionGroup the action group this action is created in - * @param shell shell to use for opening working set selection dialog. - */ - public SelectWorkingSetAction(WorkingSetFilterActionGroup actionGroup, Shell shell) { - super(WorkbenchMessages.getString("SelectWorkingSetAction.text")); //$NON-NLS-1$ - Assert.isNotNull(actionGroup); - setToolTipText(WorkbenchMessages.getString("SelectWorkingSetAction.toolTip")); //$NON-NLS-1$ - this.shell = shell; - this.actionGroup = actionGroup; - WorkbenchHelp.setHelp(this, IHelpContextIds.SELECT_WORKING_SET_ACTION); - } - /** - * Overrides method from Action - * - * @see org.eclipse.jface.Action#run - */ - public void run() { - IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager(); - IWorkingSetSelectionDialog dialog = manager.createWorkingSetSelectionDialog(shell, false); - IWorkingSet workingSet = actionGroup.getWorkingSet(); - - if (workingSet != null) - dialog.setSelection(new IWorkingSet[]{workingSet}); - - if (dialog.open() == Window.OK) { - IWorkingSet[] result = dialog.getSelection(); - if (result != null && result.length > 0) { - actionGroup.setWorkingSet(result[0]); - manager.addRecentWorkingSet(result[0]); - } - else { - actionGroup.setWorkingSet(null); - } - } - else - actionGroup.setWorkingSet(workingSet); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java deleted file mode 100644 index 2714a2500..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize.actions; - -import org.eclipse.jface.action.Action; -import org.eclipse.team.ui.synchronize.ISynchronizeParticipant; -import org.eclipse.team.ui.synchronize.ISynchronizeView; - -public class ShowSynchronizeParticipantAction extends Action { - - private ISynchronizeParticipant fPage; - private ISynchronizeView fView; - - public void run() { - if (!fPage.equals(fView.getParticipant())) { - fView.display(fPage); - } - } - - /** - * Constructs an action to display the given synchronize participant in the - * synchronize view. - * - * @param view the synchronize view in which the given page is contained - * @param participant the participant to show - */ - public ShowSynchronizeParticipantAction(ISynchronizeView view, ISynchronizeParticipant participant) { - super(participant.getName(), Action.AS_RADIO_BUTTON); - fPage = participant; - fView = view; - setImageDescriptor(participant.getImageDescriptor()); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineCLabelContribution.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineCLabelContribution.java deleted file mode 100644 index 06a76c05e..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineCLabelContribution.java +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize.actions; - -import org.eclipse.jface.action.*; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Listener; - -public class StatusLineCLabelContribution extends ContributionItem { - - public final static int DEFAULT_CHAR_WIDTH = 40; - - private int charWidth; - private CLabel label; - private Image image; - private String text = ""; //$NON-NLS-1$ - private int widthHint = -1; - - private Listener listener; - private int eventType; - private String tooltip; - - public StatusLineCLabelContribution(String id) { - this(id, DEFAULT_CHAR_WIDTH); - } - - public StatusLineCLabelContribution(String id, int charWidth) { - super(id); - this.charWidth = charWidth; - setVisible(false); // no text to start with - } - - public void fill(Composite parent) { - label = new CLabel(parent, SWT.SHADOW_IN); - StatusLineLayoutData statusLineLayoutData = new StatusLineLayoutData(); - - if (widthHint < 0) { - GC gc = new GC(parent); - gc.setFont(parent.getFont()); - widthHint = gc.getFontMetrics().getAverageCharWidth() * charWidth; - gc.dispose(); - } - - statusLineLayoutData.widthHint = widthHint; - label.setLayoutData(statusLineLayoutData); - label.setText(text); - label.setImage(image); - if(listener != null) { - label.addListener(eventType, listener); - } - if(tooltip != null) { - label.setToolTipText(tooltip); - } - } - - public void addListener(int eventType, Listener listener) { - this.eventType = eventType; - this.listener = listener; - } - - public String getText() { - return text; - } - - public void setText(String text) { - if (text == null) - throw new NullPointerException(); - - this.text = text; - - if (label != null && !label.isDisposed()) - label.setText(this.text); - - if (this.text.length() == 0) { - if (isVisible()) { - setVisible(false); - IContributionManager contributionManager = getParent(); - - if (contributionManager != null) - contributionManager.update(true); - } - } else { - if (!isVisible()) { - setVisible(true); - IContributionManager contributionManager = getParent(); - - if (contributionManager != null) - contributionManager.update(true); - } - } - } - - public void setTooltip(String tooltip) { - if (tooltip == null) - throw new NullPointerException(); - - this.tooltip = tooltip; - - if (label != null && !label.isDisposed()) { - label.setToolTipText(this.tooltip); - } - } - - public void setImage(Image image) { - if (image == null) - throw new NullPointerException(); - - this.image = image; - - if (label != null && !label.isDisposed()) - label.setImage(this.image); - - if (!isVisible()) { - setVisible(true); - IContributionManager contributionManager = getParent(); - - if (contributionManager != null) - contributionManager.update(true); - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java deleted file mode 100644 index 5d1a80a49..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java +++ /dev/null @@ -1,201 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize.actions; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.*; -import org.eclipse.team.core.ITeamStatus; -import org.eclipse.team.core.subscribers.SubscriberSyncInfoCollector; -import org.eclipse.team.core.synchronize.*; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.ui.ISharedImages; -import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IWorkingSet; -import org.eclipse.ui.actions.ActionGroup; - -public class StatusLineContributionGroup extends ActionGroup implements ISyncInfoSetChangeListener, IPropertyChangeListener { - - private static final String INCOMING_ID = TeamUIPlugin.ID + "org.eclipse.team.iu.statusline.incoming"; //$NON-NLS-1$ - private static final String OUTGOING_ID = TeamUIPlugin.ID + "org.eclipse.team.iu.statusline.outgoing"; //$NON-NLS-1$ - private static final String CONFLICTING_ID = TeamUIPlugin.ID + "org.eclipse.team.iu.statusline.conflicting"; //$NON-NLS-1$ - private static final String WORKINGSET_ID = TeamUIPlugin.ID + "org.eclipse.team.iu.statusline.workingset"; //$NON-NLS-1$ - private static final String TOTALS_ID = TeamUIPlugin.ID + "org.eclipse.team.iu.statusline.totals"; //$NON-NLS-1$ - private final static int TEXT_FIELD_MAX_SIZE = 25; - - private StatusLineCLabelContribution incoming; - private StatusLineCLabelContribution outgoing; - private StatusLineCLabelContribution conflicting; - private StatusLineCLabelContribution workingSet; - private StatusLineCLabelContribution totalChanges; - - private Image incomingImage = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_INCOMING).createImage(); - private Image outgoingImage = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_OUTGOING).createImage(); - private Image conflictingImage = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_CONFLICTING).createImage(); - - private SubscriberSyncInfoCollector collector; - private SubscriberParticipant participant; - - public StatusLineContributionGroup(final Shell shell, SubscriberParticipant participant, final WorkingSetFilterActionGroup setGroup) { - super(); - this.participant = participant; - this.collector = participant.getSubscriberSyncInfoCollector(); - this.incoming = createStatusLineContribution(INCOMING_ID, SubscriberParticipant.INCOMING_MODE, "0", incomingImage); //$NON-NLS-1$ - this.outgoing = createStatusLineContribution(OUTGOING_ID, SubscriberParticipant.OUTGOING_MODE, "0", outgoingImage); //$NON-NLS-1$ - this.conflicting = createStatusLineContribution(CONFLICTING_ID, SubscriberParticipant.CONFLICTING_MODE, "0", conflictingImage); //$NON-NLS-1$ - - this.totalChanges = new StatusLineCLabelContribution(TOTALS_ID, TEXT_FIELD_MAX_SIZE); - this.workingSet = new StatusLineCLabelContribution(WORKINGSET_ID, TEXT_FIELD_MAX_SIZE); - this.workingSet.setTooltip(Policy.bind("StatisticsPanel.workingSetTooltip")); //$NON-NLS-1$ - updateWorkingSetText(participant.getWorkingSet()); - - this.workingSet.addListener(SWT.MouseDoubleClick, new Listener() { - public void handleEvent(Event event) { - new SelectWorkingSetAction(setGroup, shell).run(); - } - }); - - // Listen to changes to update the working set - participant.addPropertyChangeListener(this); - - // Listen to changes to update the counts - collector.getSyncInfoTree().addSyncSetChangedListener(this); - } - - private boolean isThreeWay() { - return participant.getSubscriber().getResourceComparator().isThreeWay(); - } - - private void updateWorkingSetText(IWorkingSet set) { - if (set == null) { - workingSet.setText(Policy.bind("StatisticsPanel.noWorkingSet")); //$NON-NLS-1$ - } else { - String name = set.getName(); - if (name.length() > TEXT_FIELD_MAX_SIZE) { - name = name.substring(0, TEXT_FIELD_MAX_SIZE - 3) + "..."; //$NON-NLS-1$ - } - workingSet.setText(name); - } - } - - private StatusLineCLabelContribution createStatusLineContribution(String id, final int mode, String label, Image image) { - StatusLineCLabelContribution item = new StatusLineCLabelContribution(id, 15); - item.addListener(SWT.MouseDown, new Listener() { - public void handleEvent(Event event) { - participant.setMode(mode); - } - }); - item.setText(label); //$NON-NLS-1$ - item.setImage(image); - return item; - } - - public void dispose() { - collector.getSyncInfoTree().removeSyncSetChangedListener(this); - participant.removePropertyChangeListener(this); - incomingImage.dispose(); - outgoingImage.dispose(); - conflictingImage.dispose(); - } - - public void propertyChange(PropertyChangeEvent event) { - if (event.getProperty().equals(SubscriberParticipant.P_SYNCVIEWPAGE_WORKINGSET)) { - updateWorkingSetText((IWorkingSet)event.getNewValue()); - updateCounts(); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.team.internal.ui.sync.sets.ISyncSetChangedListener#syncSetChanged(org.eclipse.team.internal.ui.sync.sets.SyncSetChangedEvent) - */ - public void syncInfoChanged(ISyncInfoSetChangeEvent event, IProgressMonitor monitor) { - updateCounts(); - } - - private void updateCounts() { - if (collector != null) { - SyncInfoSet workspaceSetStats = collector.getSubscriberSyncInfoSet(); - SyncInfoSet workingSetSetStats = collector.getWorkingSetSyncInfoSet(); - - final int total = workspaceSetStats.size(); - final int workspaceConflicting = (int) workspaceSetStats.countFor(SyncInfo.CONFLICTING, SyncInfo.DIRECTION_MASK); - final int workspaceOutgoing = (int) workspaceSetStats.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK); - final int workspaceIncoming = (int) workspaceSetStats.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK); - final int workingSetConflicting = (int) workingSetSetStats.countFor(SyncInfo.CONFLICTING, SyncInfo.DIRECTION_MASK); - final int workingSetOutgoing = (int) workingSetSetStats.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK); - final int workingSetIncoming = (int) workingSetSetStats.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK); - - TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() { - public void run() { - IWorkingSet set = participant.getWorkingSet(); - if (set != null) { - conflicting.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetConflicting).toString(), new Integer(workspaceConflicting).toString())); //$NON-NLS-1$ - incoming.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetIncoming).toString(), new Integer(workspaceIncoming).toString())); //$NON-NLS-1$ - outgoing.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetOutgoing).toString(), new Integer(workspaceOutgoing).toString())); //$NON-NLS-1$ - - conflicting.setTooltip(Policy.bind("StatisticsPanel.numbersWorkingSetTooltip", Policy.bind("StatisticsPanel.conflicting"), set.getName())); //$NON-NLS-1$ //$NON-NLS-2$ - outgoing.setTooltip(Policy.bind("StatisticsPanel.numbersWorkingSetTooltip", Policy.bind("StatisticsPanel.outgoing"), set.getName())); //$NON-NLS-1$ //$NON-NLS-2$ - incoming.setTooltip(Policy.bind("StatisticsPanel.numbersWorkingSetTooltip", Policy.bind("StatisticsPanel.incoming"), set.getName())); //$NON-NLS-1$ //$NON-NLS-2$ - - } else { - conflicting.setText(new Integer(workspaceConflicting).toString()); //$NON-NLS-1$ - incoming.setText(new Integer(workspaceIncoming).toString()); //$NON-NLS-1$ - outgoing.setText(new Integer(workspaceOutgoing).toString()); //$NON-NLS-1$ - - conflicting.setTooltip(Policy.bind("StatisticsPanel.numbersTooltip", Policy.bind("StatisticsPanel.conflicting"))); //$NON-NLS-1$ //$NON-NLS-2$ - outgoing.setTooltip(Policy.bind("StatisticsPanel.numbersTooltip", Policy.bind("StatisticsPanel.outgoing"))); //$NON-NLS-1$ //$NON-NLS-2$ - incoming.setTooltip(Policy.bind("StatisticsPanel.numbersTooltip", Policy.bind("StatisticsPanel.incoming"))); //$NON-NLS-1$ //$NON-NLS-2$ - } - totalChanges.setText(Policy.bind("StatisticsPanel.numberTotal", Integer.toString(total))); //$NON-NLS-1$ - } - }); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars) - */ - public void fillActionBars(IActionBars actionBars) { - IStatusLineManager mgr = actionBars.getStatusLineManager(); - mgr.add(workingSet); - if (isThreeWay()) { - mgr.add(incoming); - mgr.add(outgoing); - mgr.add(conflicting); - } else { - mgr.add(totalChanges); - } - } - - /* (non-Javadoc) - * @see org.eclipse.team.core.subscribers.ISyncInfoSetChangeListener#syncInfoSetReset(org.eclipse.team.core.subscribers.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor) - */ - public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) { - updateCounts(); - } - - /* (non-Javadoc) - * @see org.eclipse.team.core.subscribers.ISyncInfoSetChangeListener#syncInfoSetError(org.eclipse.team.core.subscribers.SyncInfoSet, org.eclipse.team.core.ITeamStatus[], org.eclipse.core.runtime.IProgressMonitor) - */ - public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) { - // Nothing to do for errors - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java deleted file mode 100644 index ca6abf4a0..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize.actions; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.team.internal.ui.dialogs.PreferencePageContainerDialog; -import org.eclipse.team.internal.ui.preferences.SyncViewerPreferencePage; - -public class SyncViewerShowPreferencesAction extends Action { - private final Shell shell; - - public SyncViewerShowPreferencesAction(Shell shell) { - this.shell = shell; - Utils.initAction(this, "action.syncViewPreferences."); //$NON-NLS-1$ - } - - public void run() { - PreferencePage page = new SyncViewerPreferencePage(); - Dialog dialog = new PreferencePageContainerDialog(shell, page); - dialog.setBlockOnOpen(true); - dialog.open(); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java deleted file mode 100644 index 40b468a2e..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize.actions; - -import org.eclipse.jface.action.*; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.*; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.team.ui.TeamUI; -import org.eclipse.team.ui.synchronize.*; -import org.eclipse.ui.texteditor.IUpdate; - -public class SynchronizePageDropDownAction extends Action implements IMenuCreator, ISynchronizeParticipantListener, IUpdate { - - private ISynchronizeView fView; - private Menu fMenu; - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.IUpdate#update() - */ - public void update() { - ISynchronizeParticipant[] pages = TeamUI.getSynchronizeManager().getSynchronizeParticipants(); - setEnabled(pages.length >= 1); - } - - public SynchronizePageDropDownAction(ISynchronizeView view) { - fView= view; - Utils.initAction(this, "action.refreshSubscriber."); //$NON-NLS-1$ - setMenuCreator(this); - TeamUI.getSynchronizeManager().addSynchronizeParticipantListener(this); - update(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.action.IMenuCreator#dispose() - */ - public void dispose() { - if (fMenu != null) { - fMenu.dispose(); - } - - fView= null; - TeamUI.getSynchronizeManager().removeSynchronizeParticipantListener(this); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu) - */ - public Menu getMenu(Menu parent) { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control) - */ - public Menu getMenu(Control parent) { - if (fMenu != null) { - fMenu.dispose(); - } - fMenu= new Menu(parent); - ISynchronizeParticipant[] pages = TeamUI.getSynchronizeManager().getSynchronizeParticipants(); - ISynchronizeParticipant current = fView.getParticipant(); - for (int i = 0; i < pages.length; i++) { - ISynchronizeParticipant page = pages[i]; - Action action = new ShowSynchronizeParticipantAction(fView, page); - action.setChecked(page.equals(current)); - addActionToMenu(fMenu, action); - } - return fMenu; - } - - protected void addActionToMenu(Menu parent, Action action) { - ActionContributionItem item= new ActionContributionItem(action); - item.fill(parent, -1); - } - - protected void addMenuSeparator() { - new MenuItem(fMenu, SWT.SEPARATOR); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.action.IAction#run() - */ - public void run() { - // do nothing - this is a menu - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.sync.ISynchronizeParticipantListener#participantsAdded(org.eclipse.team.ui.sync.ISynchronizeParticipant[]) - */ - public void participantsAdded(ISynchronizeParticipant[] consoles) { - Display display = TeamUIPlugin.getStandardDisplay(); - display.asyncExec(new Runnable() { - public void run() { - update(); - } - }); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.sync.ISynchronizeParticipantListener#participantsRemoved(org.eclipse.team.ui.sync.ISynchronizeParticipant[]) - */ - public void participantsRemoved(ISynchronizeParticipant[] consoles) { - Display display = TeamUIPlugin.getStandardDisplay(); - display.asyncExec(new Runnable() { - public void run() { - if (fMenu != null) { - fMenu.dispose(); - } - update(); - } - }); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java deleted file mode 100644 index 109aa9c56..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetFilterActionGroup.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize.actions; - -import org.eclipse.jface.action.*; -import org.eclipse.jface.util.*; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.ui.synchronize.ISynchronizeView; -import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant; -import org.eclipse.ui.*; -import org.eclipse.ui.actions.ActionGroup; - -/** - * Adds working set filter actions (set / clear / edit) - * - * @since 2.1 - */ -public class WorkingSetFilterActionGroup extends ActionGroup { - public static final String CHANGE_WORKING_SET = "changeWorkingSet"; //$NON-NLS-1$ - - private IWorkingSet workingSet = null; - - private ClearWorkingSetAction clearWorkingSetAction; - private SelectWorkingSetAction selectWorkingSetAction; - private EditWorkingSetAction editWorkingSetAction; - private IPropertyChangeListener workingSetUpdater; - private IActionBars bars; - private IContributionItem item; - private String id; - - /** - * Creates a new instance of the receiver - * - * @param shell shell to open dialogs and wizards on - * @param workingSetUpdater property change listener notified when a - * working set is set - */ - public WorkingSetFilterActionGroup(Shell shell, IPropertyChangeListener workingSetUpdater, ISynchronizeView view, SubscriberParticipant participant) { - Assert.isNotNull(shell); - this.id = participant.toString(); - this.workingSetUpdater = workingSetUpdater; - this.workingSet = participant.getWorkingSet(); - clearWorkingSetAction = new ClearWorkingSetAction(this); - selectWorkingSetAction = new SelectWorkingSetAction(this, shell); - editWorkingSetAction = new EditWorkingSetAction(this, shell); - } - - /** - * Adds working set actions to the specified action bar. - * - * @param actionBars action bar to add working set actions to. - * @see ActionGroup#fillActionBars(IActionBars) - */ - public void fillActionBars(IActionBars actionBars) { - bars = actionBars; - IMenuManager menuManager = actionBars.getMenuManager(); - menuManager.add(selectWorkingSetAction); - menuManager.add(clearWorkingSetAction); - menuManager.add(editWorkingSetAction); - menuManager.add(new Separator(id)); - updateMruContribution(menuManager); - }; - - private void updateMruContribution(IMenuManager menuManager) { - IWorkingSet[] sets = PlatformUI.getWorkbench().getWorkingSetManager().getRecentWorkingSets(); - if(sets.length > 0) { - if(item == null) { - item = new WorkingSetMenuContributionItem(id, this); - menuManager.prependToGroup(id, item); - } - } else { - if(item != null) { - menuManager.remove(item); - } - item = null; - } - } - - /** - * Returns the working set which is currently selected. - * - * @return the working set which is currently selected. - */ - public IWorkingSet getWorkingSet() { - return workingSet; - } - - /** - * Sets the current working set. - * - * @param newWorkingSet the new working set - */ - public void setWorkingSet(IWorkingSet newWorkingSet) { - IWorkingSet oldWorkingSet = workingSet; - - workingSet = newWorkingSet; - // Update action - clearWorkingSetAction.setEnabled(newWorkingSet != null); - editWorkingSetAction.setEnabled(newWorkingSet != null); - - if(workingSet != null) - PlatformUI.getWorkbench().getWorkingSetManager().addRecentWorkingSet(newWorkingSet); - // Update viewer - if (workingSetUpdater != null) { - workingSetUpdater.propertyChange( - new PropertyChangeEvent( - this, - WorkingSetFilterActionGroup.CHANGE_WORKING_SET, - oldWorkingSet, - newWorkingSet)); - } - - // Trick to get dynamic menu contribution for most-recent list to - // be updated. These are action contributions and must be added/removed - // before the menu is shown. - // It is also quite possible that this menu hasn't been created when a - // setWorking set property change occurs. - if(bars.getMenuManager().find(id) != null) { - updateMruContribution(bars.getMenuManager()); - } - //bars.updateActionBars(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetMenuContributionItem.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetMenuContributionItem.java deleted file mode 100644 index 43d42c558..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/WorkingSetMenuContributionItem.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.synchronize.actions; - -import java.util.*; - -import org.eclipse.jface.action.ContributionItem; -import org.eclipse.jface.util.Assert; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.ui.*; -import org.eclipse.ui.internal.WorkingSetComparator; - -/** - * Menu contribution item which shows all the most recent working - * sets. - * - * @since 3.0 - */ -public class WorkingSetMenuContributionItem extends ContributionItem { - private WorkingSetFilterActionGroup actionGroup; - - /** - * Creates a new instance of the receiver. - * - * @param id sequential id of the new instance - * @param actionGroup the action group this contribution item is created in - */ - public WorkingSetMenuContributionItem(String id, WorkingSetFilterActionGroup actionGroup) { - super(id + TeamUIPlugin.ID + "working_set_contribution"); //$NON-NLS-1$ - Assert.isNotNull(actionGroup); - this.actionGroup = actionGroup; - } - - /** - * Adds a menu item for the working set. - * Overrides method from ContributionItem. - * - * @see org.eclipse.jface.action.ContributionItem#fill(Menu,int) - */ - public void fill(Menu menu, int index) { - IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getRecentWorkingSets(); - List sortedWorkingSets = Arrays.asList(workingSets); - Collections.sort(sortedWorkingSets, new WorkingSetComparator()); - - Iterator iter = sortedWorkingSets.iterator(); - int mruMenuCount = sortedWorkingSets.size(); - int i = 0; - while (iter.hasNext()) { - final IWorkingSet workingSet = (IWorkingSet)iter.next(); - if (workingSet != null) { - MenuItem mi = new MenuItem(menu, SWT.RADIO, index + i); - mi.setText("&" + (++i) + " " + workingSet.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - mi.setSelection(workingSet.equals(actionGroup.getWorkingSet())); - mi.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager(); - actionGroup.setWorkingSet(workingSet); - manager.addRecentWorkingSet(workingSet); - } - }); - } - } - } - - /** - * Overridden to always return true and force dynamic menu building. - */ - public boolean isDynamic() { - return true; - } -} - diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardElement.java deleted file mode 100644 index ba17383a1..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardElement.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.wizards; - - -import org.eclipse.core.runtime.*; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.ui.model.IWorkbenchAdapter; -import org.eclipse.ui.model.WorkbenchAdapter; - -/** - * ConfigurationWizardElement represents an item in the configuration wizard table, - * declared by an extension to the configurationWizards extension point. - */ -public class ConfigurationWizardElement extends WorkbenchAdapter implements IAdaptable { - private String id; - private String name; - private ImageDescriptor imageDescriptor; - private String description; - private IConfigurationElement configurationElement; - - /** - * Creates a new instance of this class - * - * @param name the name of the element - */ - public ConfigurationWizardElement(String name) { - this.name = name; - } - /** - * Create an the instance of the object described by the configuration - * element. That is, create the instance of the class the isv supplied in - * the extension point. - * - * @throws CoreException if an error occurs creating the extension - */ - public Object createExecutableExtension() throws CoreException { - return TeamUIPlugin.createExtension(configurationElement, ConfigureProjectWizard.ATT_CLASS); - } - /* - * Method declared on IAdaptable. - */ - public Object getAdapter(Class adapter) { - if (adapter == IWorkbenchAdapter.class) { - return this; - } - return Platform.getAdapterManager().getAdapter(this, adapter); - } - /** - * Returns the configuration element - * - * @return the configuration element - */ - public IConfigurationElement getConfigurationElement() { - return configurationElement; - } - /** - * Returns the description parameter of this element - * - * @return the description of this elemnet - */ - public String getDescription() { - return description; - } - /** - * Returns the image for the given element - * - * @param element the element to get the image for - * @return the image for the given element - */ - public ImageDescriptor getImageDescriptor(Object element) { - return imageDescriptor; - } - /** - * Returns the label for the given element - * - * @param element the element to get the label for - * @return the label for the given element - */ - public String getLabel(Object element) { - return name; - } - /** - * Returns the id as specified in the extension. - * - * @return java.lang.String - */ - public String getID() { - return id; - } - /** - * Returns the image for this element. - * - * @return the image for this element - */ - public ImageDescriptor getImageDescriptor() { - return imageDescriptor; - } - /** - * Set the configuration element - * - * @param newConfigurationElement the new configuration element - */ - public void setConfigurationElement(IConfigurationElement newConfigurationElement) { - configurationElement = newConfigurationElement; - } - /** - * Set the description parameter of this element - * - * @param value the new desrciption - */ - public void setDescription(String value) { - description = value; - } - /** - * Sets the id parameter of this element - * - * @param value the new ID - */ - public void setID(String value) { - id = value; - } - /** - * Sets the image for this element. - * - * @param value the new image - */ - public void setImageDescriptor(ImageDescriptor value) { - imageDescriptor = value; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardNode.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardNode.java deleted file mode 100644 index 05a8a6eef..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardNode.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.wizards; - - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.IWizardNode; -import org.eclipse.swt.graphics.Point; -import org.eclipse.team.internal.ui.Policy; - -/** - * ConfigurationWizardNode represents the objects in the - * table in the Configuration wizard. - */ -public class ConfigurationWizardNode implements IWizardNode { - // The element this node represents - ConfigurationWizardElement element; - // The wizard this node is in - IWizard wizard; - - /** - * Create a new ConfigurationWizardNode - * - * @param element the configuration wizard element for this node - */ - public ConfigurationWizardNode(ConfigurationWizardElement element) { - this.element = element; - } - /* - * Method declared on IWizardNode. - */ - public void dispose() { - if (wizard != null) { - wizard.dispose(); - wizard = null; - } - } - /* - * Method declared on IWizardNode. - */ - public Point getExtent() { - return new Point(-1, -1); - } - /* - * Method declared on IWizardNode. - */ - public IWizard getWizard() { - if (wizard == null) { - try { - wizard = (IWizard)element.createExecutableExtension(); - } catch (CoreException e) { - System.out.println(Policy.bind("ConfigurationWizard.exceptionCreatingWizard")); //$NON-NLS-1$ - } - } - return wizard; - } - /* - * Method declared on IWizardNode. - */ - public boolean isContentCreated() { - return wizard != null; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java deleted file mode 100644 index 0de5120b7..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java +++ /dev/null @@ -1,230 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.wizards; - - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.*; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.ui.*; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.model.AdaptableList; - -/** - * The wizard for associating projects with team providers - */ -public class ConfigureProjectWizard extends Wizard implements IConfigurationWizard { - protected IWorkbench workbench; - protected IProject project; - protected IConfigurationWizard wizard; - - protected ConfigureProjectWizardMainPage mainPage; - private String pluginId = TeamUIPlugin.PLUGIN_ID; - - protected final static String TAG_WIZARD = "wizard"; //$NON-NLS-1$ - protected final static String TAG_DESCRIPTION = "description"; //$NON-NLS-1$ - protected final static String ATT_NAME = "name"; //$NON-NLS-1$ - protected final static String ATT_CLASS = "class"; //$NON-NLS-1$ - protected final static String ATT_ICON = "icon"; //$NON-NLS-1$ - protected final static String ATT_ID = "id"; //$NON-NLS-1$ - - public ConfigureProjectWizard() { - setNeedsProgressMonitor(true); - setWindowTitle(getWizardWindowTitle()); //$NON-NLS-1$ - } - - protected String getExtensionPoint() { - return ITeamUIConstants.PT_CONFIGURATION; - } - - protected String getWizardWindowTitle() { - return Policy.bind("ConfigureProjectWizard.title"); //$NON-NLS-1$ - } - - protected String getWizardLabel() { - return Policy.bind("ConfigureProjectWizard.configureProject"); //$NON-NLS-1$ - } - - protected String getWizardDescription() { - return Policy.bind("ConfigureProjectWizard.description"); //$NON-NLS-1$ - } - - /* - * @see Wizard#addPages - */ - public void addPages() { - AdaptableList wizards = getAvailableWizards(); - if (wizards.size() == 1) { - // If there is only one wizard, skip the first page. - // Only skip the first page if the one wizard has at least one page. - ConfigurationWizardElement element = (ConfigurationWizardElement)wizards.getChildren()[0]; - try { - this.wizard = (IConfigurationWizard)element.createExecutableExtension(); - wizard.init(workbench, project); - wizard.addPages(); - if (wizard.getPageCount() > 0) { - wizard.setContainer(getContainer()); - IWizardPage[] pages = wizard.getPages(); - for (int i = 0; i < pages.length; i++) { - addPage(pages[i]); - } - return; - } - } catch (CoreException e) { - TeamUIPlugin.log(e); - return; - } - } - mainPage = new ConfigureProjectWizardMainPage("configurePage1", getWizardLabel(), TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_WIZBAN_SHARE), wizards); //$NON-NLS-1$ - mainPage.setDescription(getWizardDescription()); - mainPage.setProject(project); - mainPage.setWorkbench(workbench); - addPage(mainPage); - } - public IWizardPage getNextPage(IWizardPage page) { - if (wizard != null) { - return wizard.getNextPage(page); - } - return super.getNextPage(page); - } - public boolean canFinish() { - // If we are on the first page, never allow finish unless the selected wizard has no pages. - if (getContainer().getCurrentPage() == mainPage) { - if (mainPage.getSelectedWizard() != null && mainPage.getNextPage() == null) { - return true; - } - return false; - } - if (wizard != null) { - return wizard.canFinish(); - } - return super.canFinish(); - } - /* - * @see Wizard#performFinish - */ - public boolean performFinish() { - // There is only one wizard with at least one page - if (wizard != null) { - return wizard.performFinish(); - } - // If we are on the first page and the selected wizard has no pages then - // allow it to finish. - if (getContainer().getCurrentPage() == mainPage) { - IConfigurationWizard noPageWizard = mainPage.getSelectedWizard(); - if (noPageWizard != null) { - if (noPageWizard.canFinish()) - { - return noPageWizard.performFinish(); - } - } - } - // If the wizard has pages and there are several - // wizards registered then the registered wizard - // will call it's own performFinish(). - return true; - } - /** - * Returns the configuration wizards that are available for invocation. - * - * @return the available wizards - */ - protected AdaptableList getAvailableWizards() { - AdaptableList result = new AdaptableList(); - IPluginRegistry registry = Platform.getPluginRegistry(); - IExtensionPoint point = registry.getExtensionPoint(pluginId, getExtensionPoint()); - if (point != null) { - IExtension[] extensions = point.getExtensions(); - for (int i = 0; i < extensions.length; i++) { - IConfigurationElement[] elements = extensions[i].getConfigurationElements(); - for (int j = 0; j < elements.length; j++) { - IConfigurationElement element = elements[j]; - if (element.getName().equals(TAG_WIZARD)) { - ConfigurationWizardElement wizard = createWizardElement(element); - if (wizard != null) { - result.add(wizard); - } - } - } - } - } - - return result; - } - /** - * Returns a new ConfigurationWizardElement configured according to the parameters - * contained in the passed Registry. - * - * May answer null if there was not enough information in the Extension to create - * an adequate wizard - * - * @param element the element for which to create a wizard element - * @return the wizard element for the given element - */ - protected ConfigurationWizardElement createWizardElement(IConfigurationElement element) { - // WizardElements must have a name attribute - String nameString = element.getAttribute(ATT_NAME); - if (nameString == null) { - // Missing attribute - return null; - } - ConfigurationWizardElement result = new ConfigurationWizardElement(nameString); - if (initializeWizard(result, element)) { - // initialization was successful - return result; - } - return null; - } - /** - * Initialize the passed element's properties based on the contents of - * the passed registry. Answer a boolean indicating whether the element - * was able to be adequately initialized. - * - * @param element the element to initialize the properties for - * @param extension the registry to get properties from - * @return whether initialization was successful - */ - protected boolean initializeWizard(ConfigurationWizardElement element, IConfigurationElement config) { - element.setID(config.getAttribute(ATT_ID)); - String description = ""; //$NON-NLS-1$ - IConfigurationElement [] children = config.getChildren(TAG_DESCRIPTION); - if (children.length >= 1) { - description = children[0].getValue(); - } - - element.setDescription(description); - - // apply CLASS and ICON properties - element.setConfigurationElement(config); - String iconName = config.getAttribute(ATT_ICON); - if (iconName != null) { - IExtension extension = config.getDeclaringExtension(); - element.setImageDescriptor(TeamUIPlugin.getImageDescriptorFromExtension(extension, iconName)); - } - // ensure that a class was specified - if (element.getConfigurationElement() == null) { - // Missing attribute - return false; - } - setForcePreviousAndNextButtons(true); - return true; - } - /* - * Method declared on IConfigurationWizard - */ - public void init(IWorkbench workbench, IProject project) { - this.workbench = workbench; - this.project = project; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java deleted file mode 100644 index b0849aa9a..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java +++ /dev/null @@ -1,179 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.wizards; - - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.*; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.*; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.ui.IConfigurationWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.model.*; - -/** - * The main page of the configure project wizard. It contains a table - * which lists possible team providers with which to configure the project. - * The user may select one and press "Next", which will display a provider- - * specific wizard page. - */ -public class ConfigureProjectWizardMainPage extends WizardPage { - private Table table; - private TableViewer viewer; - private AdaptableList wizards; - private IWorkbench workbench; - private IProject project; - private String description; - - private IConfigurationWizard selectedWizard; - - /** - * Create a new ConfigureProjectWizardMainPage - * - * @param pageName the name of the page - * @param title the title of the page - * @param titleImage the image for the page title - * @param wizards the wizards to populate the table with - */ - public ConfigureProjectWizardMainPage(String pageName, String title, ImageDescriptor titleImage, AdaptableList wizards) { - this(pageName,title,titleImage,wizards,Policy.bind("ConfigureProjectWizardMainPage.selectRepository")); //$NON-NLS-1$ - } - - /** - * Create a new ConfigureProjectWizardMainPage - * - * @param pageName the name of the page - * @param title the title of the page - * @param titleImage the image for the page title - * @param wizards the wizards to populate the table with - * @param description The string to use as a description label - */ - public ConfigureProjectWizardMainPage(String pageName, String title, ImageDescriptor titleImage, AdaptableList wizards, String description) { - super(pageName, title, titleImage); - this.wizards = wizards; - this.description = description; - } - - public IConfigurationWizard getSelectedWizard() { - return selectedWizard; - } - /* - * @see WizardPage#canFlipToNextPage - */ - public boolean canFlipToNextPage() { - return selectedWizard != null && selectedWizard.getPageCount() > 0; - } - /* - * @see WizardPage#createControl - */ - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout()); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - - setControl(composite); - - // set F1 help - WorkbenchHelp.setHelp(composite, IHelpContextIds.SHARE_PROJECT_PAGE); - - Label label = new Label(composite, SWT.LEFT); - label.setText(description); - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - label.setLayoutData(data); - - table = new Table(composite, SWT.SINGLE | SWT.BORDER); - data = new GridData(GridData.FILL_BOTH); - data.heightHint = table.getItemHeight() * 7; - table.setLayoutData(data); - viewer = new TableViewer(table); - viewer.setContentProvider(new WorkbenchContentProvider()); - viewer.setLabelProvider(new WorkbenchLabelProvider()); - viewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - // Initialize the wizard so we can tell whether to enable the Next button - ISelection selection = event.getSelection(); - if (selection == null || !(selection instanceof IStructuredSelection)) { - selectedWizard = null; - setPageComplete(false); - return; - } - IStructuredSelection ss = (IStructuredSelection)selection; - if (ss.size() != 1) { - selectedWizard = null; - setPageComplete(false); - return; - } - ConfigurationWizardElement selectedElement = (ConfigurationWizardElement)ss.getFirstElement(); - try { - selectedWizard = (IConfigurationWizard)selectedElement.createExecutableExtension(); - selectedWizard.init(workbench, project); - } catch (CoreException e) { - return; - } - selectedWizard.addPages(); - - // Ask the container to update button enablement - setPageComplete(true); - } - }); - viewer.addDoubleClickListener(new IDoubleClickListener() { - public void doubleClick(DoubleClickEvent event) { - getWizard().getContainer().showPage(getNextPage()); - } - }); - viewer.setInput(wizards); - Dialog.applyDialogFont(parent); - } - /** - * The <code>WizardSelectionPage</code> implementation of - * this <code>IWizardPage</code> method returns the first page - * of the currently selected wizard if there is one. - * - * @see WizardPage#getNextPage - */ - public IWizardPage getNextPage() { - if (selectedWizard == null) return null; - return selectedWizard.getStartingPage(); - } - /** - * Set the workbench to the argument - * - * @param workbench the workbench to set - */ - public void setWorkbench(IWorkbench workbench) { - this.workbench = workbench; - } - /** - * Set the project to the argument - * - * @param project the project to set - */ - public void setProject(IProject project) { - this.project = project; - } - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - table.setFocus(); - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java deleted file mode 100644 index 693f6fd3a..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java +++ /dev/null @@ -1,202 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.wizards; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.viewers.TableLayout; -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.Event; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.Text; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.model.WorkbenchContentProvider; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -public class ExportProjectSetMainPage extends TeamWizardPage { - Text fileText; - String file = ""; //$NON-NLS-1$ - Button browseButton; - List selectedProjects = new ArrayList(); - - CheckboxTableViewer tableViewer; - Table table; - - class ProjectContentProvider extends WorkbenchContentProvider { - public Object[] getElements(Object element) { - if (element instanceof IProject[]) return (IProject[]) element; - return null; - } - }; - - public ExportProjectSetMainPage(String pageName, String title, ImageDescriptor titleImage) { - super(pageName, title, titleImage); - } - - /* - * @see IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) { - Composite composite = createComposite(parent, 1); - initializeDialogUnits(composite); - - // set F1 help - WorkbenchHelp.setHelp(composite, IHelpContextIds.EXPORT_PROJECT_SET_PAGE); - - createLabel(composite, Policy.bind("ExportProjectSetMainPage.Select_the_projects_to_include_in_the_project_set__2")); //$NON-NLS-1$ - - table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); - tableViewer = new CheckboxTableViewer(table); - table.setLayout(new TableLayout()); - GridData data = new GridData(GridData.FILL_BOTH); - data.heightHint = 300; - table.setLayoutData(data); - tableViewer.setContentProvider(new ProjectContentProvider()); - tableViewer.setLabelProvider(new WorkbenchLabelProvider()); - tableViewer.addCheckStateListener(new ICheckStateListener() { - public void checkStateChanged(CheckStateChangedEvent event) { - IProject project = (IProject)event.getElement(); - if (event.getChecked()) { - selectedProjects.add(project); - } else { - selectedProjects.remove(project); - } - updateEnablement(); - } - }); - createLabel(composite, Policy.bind("ExportProjectSetMainPage.Project_Set_File_Name__3")); //$NON-NLS-1$ - - Composite inner = new Composite(composite, SWT.NULL); - inner.setLayoutData(new GridData(GridData.FILL_BOTH)); - GridLayout layout = new GridLayout(); - layout.numColumns = 3; - layout.marginHeight = 0; - layout.marginWidth = 0; - inner.setLayout(layout); - - createLabel(inner, Policy.bind("ExportProjectSetMainPage.&File_name__1")); //$NON-NLS-1$ - fileText = createTextField(inner); - if (file != null) fileText.setText(file); - fileText.addListener(SWT.Modify, new Listener() { - public void handleEvent(Event event) { - file = fileText.getText(); - updateEnablement(); - } - }); - - browseButton = new Button(inner, SWT.PUSH); - browseButton.setText(Policy.bind("ExportProjectSetMainPage.Browse_4")); //$NON-NLS-1$ - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - browseButton.setLayoutData(data); - browseButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - FileDialog d = new FileDialog(getShell(), SWT.SAVE); - d.setFilterExtensions(new String[] {"*.psf"}); //$NON-NLS-1$ - d.setFilterNames(new String[] {Policy.bind("ExportProjectSetMainPage.Project_Set_Files_3")}); //$NON-NLS-1$ - d.setFileName(Policy.bind("ExportProjectSetMainPage.default")); //$NON-NLS-1$ - d.setFilterPath(new File(".").getAbsolutePath()); //$NON-NLS-1$ - String f = d.open(); - if (f != null) { - fileText.setText(f); - file = f; - } - } - }); - - initializeProjects(); - setControl(composite); - updateEnablement(); - Dialog.applyDialogFont(parent); - } - - private void initializeProjects() { - List projectList = new ArrayList(); - IProject[] workspaceProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); - for (int i = 0; i < workspaceProjects.length; i++) { - if (RepositoryProvider.getProvider(workspaceProjects[i]) != null) { - projectList.add(workspaceProjects[i]); - } - } - tableViewer.setInput((IProject[]) projectList.toArray(new IProject[projectList.size()])); - // Check any necessary projects - if (selectedProjects != null) { - tableViewer.setCheckedElements((IProject[])selectedProjects.toArray(new IProject[selectedProjects.size()])); - } - } - private void updateEnablement() { - boolean complete; - if (selectedProjects.size() == 0) { - setMessage(null); - complete = false; - } else if (file.length() == 0) { - setMessage(null); - complete = false; - } else { - File f = new File(file); - if (f.isDirectory()) { - setMessage(Policy.bind("ExportProjectSetMainPage.You_have_specified_a_folder_5"), ERROR); //$NON-NLS-1$ - complete = false; - } else { - complete = true; - } - } - if (complete) { - setMessage(null); - } - setPageComplete(complete); - } - - public String getFileName() { - return file; - } - public void setFileName(String file) { - if (file != null) { - this.file = file; - } - } - - public IProject[] getSelectedProjects() { - return (IProject[])selectedProjects.toArray(new IProject[selectedProjects.size()]); - } - public void setSelectedProjects(IProject[] selectedProjects) { - this.selectedProjects.addAll(Arrays.asList(selectedProjects)); - } - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - fileText.setFocus(); - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshParticipantSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshParticipantSelectionPage.java deleted file mode 100644 index ac82939c1..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshParticipantSelectionPage.java +++ /dev/null @@ -1,185 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.wizards; - -import java.util.*; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.*; -import org.eclipse.jface.wizard.*; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.team.ui.TeamUI; -import org.eclipse.team.ui.synchronize.*; -import org.eclipse.ui.model.BaseWorkbenchContentProvider; -import org.eclipse.ui.views.navigator.ResourceSorter; - -/** - * Page that allows the user to select a set of resources that are managed - * by a synchronize participant. - * - * Remembers last participant - * - * @since 3.0 - */ -public class GlobalRefreshParticipantSelectionPage extends WizardPage implements IDoubleClickListener, ISelectionChangedListener { - - private TableViewer fViewer; - private ISynchronizeParticipantDescriptor selectedParticipantDescriptor; - private IWizard wizard; - private ISynchronizeParticipant participant; - private List createdImages; - - class MyContentProvider extends BaseWorkbenchContentProvider { - public Object[] getChildren(Object element) { - if(element instanceof ISynchronizeManager) { - List participants = new ArrayList(); - ISynchronizeManager manager = (ISynchronizeManager)element; - ISynchronizeParticipant[] desciptors = manager.getSynchronizeParticipants(); - for (int i = 0; i < desciptors.length; i++) { - ISynchronizeParticipant descriptor = desciptors[i]; - if(descriptor.doesSupportSynchronize()) { - participants.add(descriptor); - } - } - return (ISynchronizeParticipant[]) participants.toArray(new ISynchronizeParticipant[participants.size()]); - } - return super.getChildren(element); - } - } - - class MyLabelProvider extends LabelProvider { - public String getText(Object element) { - if(element instanceof ISynchronizeParticipant) { - ISynchronizeParticipant descriptor = (ISynchronizeParticipant)element; - return descriptor.getName(); - } - return null; - } - - public Image getImage(Object element) { - if(element instanceof ISynchronizeParticipant) { - ISynchronizeParticipant descriptor = (ISynchronizeParticipant)element; - ImageDescriptor d = descriptor.getImageDescriptor(); - if(createdImages == null) { - createdImages = new ArrayList(3); - } - Image image = d.createImage(); - createdImages.add(image); - return image; - } - return null; - } - } - - public GlobalRefreshParticipantSelectionPage() { - super("Synchronize"); - setDescription("Select the participant to synchronize"); - setTitle("Select a Synchronize Participant"); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.IDialogPage#dispose() - */ - public void dispose() { - if (createdImages != null) { - for (Iterator it = createdImages.iterator(); it.hasNext();) { - Image image = (Image) it.next(); - image.dispose(); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent2) { - Composite top = new Composite(parent2, SWT.NULL); - top.setLayout(new GridLayout()); - setControl(top); - - Label l = new Label(top, SWT.NULL); - l.setText("Available synchronize participants:"); - fViewer = new TableViewer(top, SWT.BORDER); - GridData data = new GridData(GridData.FILL_BOTH); - fViewer.getControl().setLayoutData(data); - fViewer.setContentProvider(new MyContentProvider()); - fViewer.addDoubleClickListener(this); - fViewer.setLabelProvider(new MyLabelProvider()); - fViewer.setSorter(new ResourceSorter(ResourceSorter.NAME)); - fViewer.setInput(TeamUI.getSynchronizeManager()); - fViewer.addSelectionChangedListener(this); - fViewer.getTable().setFocus(); - Dialog.applyDialogFont(parent2); - } - - public void doubleClick(DoubleClickEvent event) { - selectionChanged( - new SelectionChangedEvent( - event.getViewer(), - event.getViewer().getSelection())); - getContainer().showPage(getNextPage()); - } - - public void selectionChanged(SelectionChangedEvent event) { - // Initialize the wizard so we can tell whether to enable the - // Next button - ISelection selection = event.getSelection(); - if (selection == null || !(selection instanceof IStructuredSelection)) { - wizard = null; - setPageComplete(false); - return; - } - IStructuredSelection ss = (IStructuredSelection) selection; - if (ss.size() != 1) { - wizard = null; - setPageComplete(false); - return; - } - participant = (ISynchronizeParticipant)ss.getFirstElement(); - wizard = participant.createSynchronizeWizard(); - wizard.addPages(); - // Ask the container to update button enablement - setPageComplete(true); - } - - public IWizard getSelectedWizard() { - return this.wizard; - } - - public ISynchronizeParticipant getSelectedParticipant() { - return this.participant; - } - - /** - * The <code>WizardSelectionPage</code> implementation of - * this <code>IWizardPage</code> method returns the first page - * of the currently selected wizard if there is one. - * - * @see WizardPage#getNextPage - */ - public IWizardPage getNextPage() { - if (wizard == null) return null; - return wizard.getStartingPage(); - } - - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - fViewer.getTable().setFocus(); - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshResourceSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshResourceSelectionPage.java deleted file mode 100644 index e269f03b3..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshResourceSelectionPage.java +++ /dev/null @@ -1,240 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.wizards; - -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.*; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.*; -import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant; -import org.eclipse.ui.*; -import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog; -import org.eclipse.ui.ide.IDE; -import org.eclipse.ui.internal.dialogs.ContainerCheckedTreeViewer; -import org.eclipse.ui.model.BaseWorkbenchContentProvider; -import org.eclipse.ui.model.WorkbenchLabelProvider; -import org.eclipse.ui.views.navigator.ResourceSorter; - -/** - * Page that allows the user to select a set of resources that are managed - * by a synchronize participant. - * - * Remembers last selection - * Remembers last working set - * - * @since 3.0 - */ -public class GlobalRefreshResourceSelectionPage extends WizardPage { - - private SubscriberParticipant participant; - private Button selectOutgoingChanges; - private ContainerCheckedTreeViewer fViewer; - - class MyContentProvider extends BaseWorkbenchContentProvider { - public Object[] getChildren(Object element) { - if(element instanceof SubscriberParticipant) { - return ((SubscriberParticipant)element).getResources(); - } - return super.getChildren(element); - } - } - - class MyLabelProvider extends LabelProvider { - private LabelProvider workbenchProvider = new WorkbenchLabelProvider(); - public String getText(Object element) { - if(element instanceof IContainer) { - IContainer c = (IContainer)element; - List participantRoots = Arrays.asList(participant.getResources()); - if(participantRoots.contains(c)) { - return c.getFullPath().toString(); - } - } - return workbenchProvider.getText(element); - } - public Image getImage(Object element) { - return workbenchProvider.getImage(element); - } - } - - class MyContainerCheckedTree extends ContainerCheckedTreeViewer { - - public MyContainerCheckedTree(Composite parent, int style) { - super(parent, style); - } - - protected void doCheckStateChanged(Object element) { - Widget item = findItem(element); - if (item instanceof TreeItem) { - TreeItem treeItem = (TreeItem) item; - treeItem.setGrayed(false); - //updateChildrenItems(treeItem); - doUpdateParentItems(treeItem.getParentItem()); - } - } - - /** - * Updates the check / gray state of all parent items - */ - private void doUpdateParentItems(TreeItem item) { - if (item != null) { - Item[] children = getChildren(item); - boolean containsChecked = false; - boolean containsUnchecked = false; - for (int i = 0; i < children.length; i++) { - TreeItem curr = (TreeItem) children[i]; - containsChecked |= curr.getChecked(); - containsUnchecked |= (!curr.getChecked() || curr.getGrayed()); - } - item.setChecked(containsChecked); - item.setGrayed(containsChecked && containsUnchecked); - doUpdateParentItems(item.getParentItem()); - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.internal.dialogs.ContainerCheckedTreeViewer#setExpanded(org.eclipse.swt.widgets.Item, boolean) - */ - protected void setExpanded(Item item, boolean expand) { - ((TreeItem) item).setExpanded(expand); - } - } - - public GlobalRefreshResourceSelectionPage(SubscriberParticipant participant) { - super("Synchronize"); - setDescription("Select the resource to synchronize"); - setTitle("Synchronize"); - setParticipant(participant); - } - - public void setParticipant(SubscriberParticipant participant) { - this.participant = participant; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent2) { - Composite top = new Composite(parent2, SWT.NULL); - top.setLayout(new GridLayout()); - top.setLayoutData(new GridData(GridData.FILL_BOTH)); - setControl(top); - - if (participant.getSubscriber().roots().length == 0) { - Label l = new Label(top, SWT.NULL); - l.setText("There are no resources associated with '" + participant.getName() + "''."); - } else { - Label l = new Label(top, SWT.NULL); - l.setText("Available resources to Synchronize:"); - fViewer = new ContainerCheckedTreeViewer(top, SWT.BORDER) { - - }; - GridData data = new GridData(GridData.FILL_BOTH); - fViewer.getControl().setLayoutData(data); - fViewer.setContentProvider(new MyContentProvider()); - fViewer.setLabelProvider(new MyLabelProvider()); - fViewer.addCheckStateListener(new ICheckStateListener() { - public void checkStateChanged(CheckStateChangedEvent event) { - updateOKStatus(); - } - }); - fViewer.setSorter(new ResourceSorter(ResourceSorter.NAME)); - fViewer.setInput(participant); - - Composite buttonComposote = new Composite(top, SWT.NULL); - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.numColumns = 3; - layout.makeColumnsEqualWidth = true; - buttonComposote.setLayout(layout); - data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); - buttonComposote.setLayoutData(data); - - Button selectAll = new Button(buttonComposote, SWT.NULL); - selectAll.setText("&Select All"); - selectAll.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - fViewer.setCheckedElements(participant.getResources()); - updateOKStatus(); - } - }); - data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - selectAll.setLayoutData(data); - Dialog.applyDialogFont(selectAll); - - Button deSelectAll = new Button(buttonComposote, SWT.NULL); - deSelectAll.setText("&Deselect All"); - deSelectAll.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - fViewer.setCheckedElements(new Object[0]); - updateOKStatus(); - } - }); - data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - deSelectAll.setLayoutData(data); - Dialog.applyDialogFont(deSelectAll); - - Button selectWorkingSetButton = new Button(buttonComposote, SWT.NULL); - selectWorkingSetButton.setText("&Working Set..."); - selectWorkingSetButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager(); - IWorkingSetSelectionDialog dialog = manager.createWorkingSetSelectionDialog(getShell(), false); - dialog.open(); - IWorkingSet[] workingSet = dialog.getSelection(); - if(workingSet != null) { - for (int i = 0; i < workingSet.length; i++) { - IWorkingSet set = workingSet[i]; - List resources = IDE.computeSelectedResources(new StructuredSelection(set.getElements())); - if(! resources.isEmpty()) { - fViewer.setCheckedElements((IResource[])resources.toArray(new IResource[resources.size()])); - } - } - updateOKStatus(); - } - } - }); - data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - selectWorkingSetButton.setLayoutData(data); - Dialog.applyDialogFont(selectWorkingSetButton); - } - updateOKStatus(); - Dialog.applyDialogFont(top); - } - - protected void updateOKStatus() { - if(fViewer != null) { - setPageComplete(fViewer.getCheckedElements().length > 0); - } else { - setPageComplete(true); - } - } - - public IResource[] getSelectedResources() { - if(fViewer != null) { - List resources = IDE.computeSelectedResources(new StructuredSelection(fViewer.getCheckedElements())); - return (IResource[]) resources.toArray(new IResource[resources.size()]); - } else { - return null; - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java deleted file mode 100644 index 5844001d9..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.wizards; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.wizard.*; -import org.eclipse.team.internal.ui.IPreferenceIds; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.ui.*; -import org.eclipse.team.ui.synchronize.ISynchronizeManager; -import org.eclipse.team.ui.synchronize.ISynchronizeParticipant; -import org.eclipse.ui.IWorkbench; - -/** - * The wizard for synchronizing a synchronize participant. - * - * @since 3.0 - */ -public class GlobalSynchronizeWizard extends Wizard { - - protected IWorkbench workbench; - protected IWizard wizard; - protected GlobalRefreshParticipantSelectionPage mainPage; - protected ISynchronizeParticipant participant; - private String pluginId = TeamUIPlugin.PLUGIN_ID; - - public GlobalSynchronizeWizard() { - setNeedsProgressMonitor(true); - setWindowTitle("Synchronize"); //$NON-NLS-1$ - setDefaultPageImageDescriptor(TeamImages.getImageDescriptor(ISharedImages.IMG_WIZBAN_SHARE)); - setForcePreviousAndNextButtons(true); - } - - /* - * @see Wizard#addPages - */ - public void addPages() { - ISynchronizeParticipant[] participants = getParticipants(); - if (participants.length == 1) { - // If there is only one wizard, skip the first page. - // Only skip the first page if the one wizard has at least one - // page. - participant = participants[0]; - IWizard wizard = participants[0].createSynchronizeWizard(); - wizard.addPages(); - if (wizard.getPageCount() > 0) { - wizard.setContainer(getContainer()); - IWizardPage[] pages = wizard.getPages(); - for (int i = 0; i < pages.length; i++) { - addPage(pages[i]); - } - return; - } - } - mainPage = new GlobalRefreshParticipantSelectionPage(); - addPage(mainPage); - } - - public IWizardPage getNextPage(IWizardPage page) { - if (wizard != null) { - return wizard.getNextPage(page); - } - return super.getNextPage(page); - } - - public boolean canFinish() { - // If we are on the first page, never allow finish unless the selected - // wizard has no pages. - if (getContainer().getCurrentPage() == mainPage) { - if (mainPage.getSelectedWizard() != null && mainPage.getNextPage() == null) { - return true; - } - return false; - } - if (wizard != null) { - return wizard.canFinish(); - } - return super.canFinish(); - } - - /* - * @see Wizard#performFinish - */ - public boolean performFinish() { - // There is only one wizard with at least one page - if (wizard != null) { - TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT, getSelectedParticipant().getId()); - return wizard.performFinish(); - } - // If we are on the first page and the selected wizard has no pages then allow it to finish. - if (getContainer().getCurrentPage() == mainPage) { - IWizard noPageWizard = mainPage.getSelectedWizard(); - if (noPageWizard != null) { - if (noPageWizard.canFinish()) { - TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT, getSelectedParticipant().getId()); - return noPageWizard.performFinish(); - } - } - } - // If the wizard has pages and there are several - // wizards registered then the registered wizard - // will call it's own performFinish(). - TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT, getSelectedParticipant().getId()); - return true; - } - - protected ISynchronizeParticipant[] getParticipants() { - List participants = new ArrayList(); - ISynchronizeManager manager = (ISynchronizeManager) TeamUI.getSynchronizeManager(); - ISynchronizeParticipant[] desciptors = manager.getSynchronizeParticipants(); - for (int i = 0; i < desciptors.length; i++) { - ISynchronizeParticipant descriptor = desciptors[i]; - if (descriptor.doesSupportSynchronize()) { - participants.add(descriptor); - } - } - return (ISynchronizeParticipant[]) participants.toArray(new ISynchronizeParticipant[participants.size()]); - } - - protected ISynchronizeParticipant getSelectedParticipant() { - if(participant == null && mainPage != null) { - return mainPage.getSelectedParticipant(); - } else { - return participant; - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java deleted file mode 100644 index e1a5b9133..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java +++ /dev/null @@ -1,216 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.wizards; - -import java.io.File; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -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.Event; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Text; -import org.eclipse.team.internal.ui.IHelpContextIds; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.ui.IWorkingSet; -import org.eclipse.ui.help.WorkbenchHelp; - -public class ImportProjectSetMainPage extends TeamWizardPage { - Text fileText; - String file = ""; //$NON-NLS-1$ - Button browseButton; - Button createWorkingSetButton; - Text workingSetNameField; - - private boolean createWorkingSet = false; - private String workingSetName = ""; //$NON-NLS-1$ - - // constants - private static final int SIZING_TEXT_FIELD_WIDTH = 80; - - public ImportProjectSetMainPage(String pageName, String title, ImageDescriptor titleImage) { - super(pageName, title, titleImage); - } - - /* - * @see IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) { - Composite composite = createComposite(parent, 1); - initializeDialogUnits(composite); - - // set F1 help - WorkbenchHelp.setHelp(composite, IHelpContextIds.IMPORT_PROJECT_SET_PAGE); - - Composite inner = new Composite(composite, SWT.NULL); - inner.setLayoutData(new GridData(GridData.FILL_BOTH)); - GridLayout layout = new GridLayout(); - layout.numColumns = 3; - layout.marginHeight = 0; - layout.marginWidth = 0; - inner.setLayout(layout); - - createLabel(inner, Policy.bind("ImportProjectSetMainPage.Project_Set_File_Name__2")); //$NON-NLS-1$ - fileText = createTextField(inner); - if (file != null) fileText.setText(file); - fileText.addListener(SWT.Modify, new Listener() { - public void handleEvent(Event event) { - file = fileText.getText(); - updateEnablement(); - } - }); - - browseButton = new Button(inner, SWT.PUSH); - browseButton.setText(Policy.bind("ImportProjectSetMainPage.Browse_3")); //$NON-NLS-1$ - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - data.widthHint = Math.max(widthHint, browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - browseButton.setLayoutData(data); - browseButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - FileDialog d = new FileDialog(getShell()); - d.setFilterExtensions(new String[] {"*.psf", "*"}); //$NON-NLS-1$ //$NON-NLS-2$ - d.setFilterNames(new String[] {Policy.bind("ImportProjectSetMainPage.Project_Set_Files_2"), Policy.bind("ImportProjectSetMainPage.allFiles")}); //$NON-NLS-1$ //$NON-NLS-2$ - d.setFilterPath(new File(".").getAbsolutePath()); //$NON-NLS-1$ - String f = d.open(); - if (f != null) { - fileText.setText(f); - file = f; - } - } - }); - - createWorkinSetCreationArea(inner, 3); - setControl(composite); - updateEnablement(); - Dialog.applyDialogFont(parent); - } - - /** - * Method createWorkinSetCreationArea. - * @param inner - */ - private void createWorkinSetCreationArea(Composite composite, int numColumns) { - - createWorkingSetButton = new Button(composite, SWT.CHECK | SWT.RIGHT); - createWorkingSetButton.setText(Policy.bind("ImportProjectSetMainPage.createWorkingSetLabel")); //$NON-NLS-1$ - createWorkingSetButton.setSelection(createWorkingSet); - GridData data = new GridData(); - data.horizontalSpan = numColumns; - createWorkingSetButton.setLayoutData(data); - - final Label label = new Label(composite, SWT.NONE); - label.setText(Policy.bind("ImportProjectSetMainPage.workingSetLabel")); //$NON-NLS-1$ - data = new GridData(); - data.horizontalSpan = 1; - label.setLayoutData(data); - label.setEnabled(createWorkingSet); - - workingSetNameField = new Text(composite, SWT.BORDER); - data = new GridData(GridData.FILL_HORIZONTAL); - data.widthHint = SIZING_TEXT_FIELD_WIDTH; - data.horizontalSpan = 1; - workingSetNameField.setLayoutData(data); - workingSetNameField.setEnabled(createWorkingSet); - - createWorkingSetButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - createWorkingSet = createWorkingSetButton.getSelection(); - label.setEnabled(createWorkingSet); - workingSetNameField.setEnabled(createWorkingSet); - updateEnablement(); - } - }); - workingSetNameField.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - updateEnablement(); - } - }); - } - - private boolean validateWorkingSetName() { - if (createWorkingSet) { - workingSetName = workingSetNameField.getText(); - if (workingSetName.length() == 0) { - setMessage(Policy.bind("ImportProjectSetMainPage.workingSetNameEmpty"), ERROR); //$NON-NLS-1$ - return false; - } else { - // todo: verify name doesn't already exist - IWorkingSet existingSet = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager().getWorkingSet(workingSetName); - if (existingSet != null) { - setMessage(Policy.bind("ImportProjectSetMainPage.workingSetNameExists"), WARNING); //$NON-NLS-1$ - return true; - } - } - } - setMessage(null); - return true; - } - - private void updateEnablement() { - boolean complete; - setMessage(null); - if (file.length() == 0) { - complete = false; - } else { - // See if the file exists - File f = new File(file); - if (!f.exists()) { - setMessage(Policy.bind("ImportProjectSetMainPage.The_specified_file_does_not_exist_4"), ERROR); //$NON-NLS-1$ - complete = false; - } else if (f.isDirectory()) { - setMessage(Policy.bind("ImportProjectSetMainPage.You_have_specified_a_folder_5"), ERROR); //$NON-NLS-1$ - complete = false; - } else { - complete = validateWorkingSetName(); - } - } - setPageComplete(complete); - } - - public String getFileName() { - return file; - } - public void setFileName(String file) { - if (file != null) { - this.file = file; - } - } - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - fileText.setFocus(); - } - } - - /** - * @return String - */ - public String getWorkingSetName() { - if (!createWorkingSet) return null; - return workingSetName; - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java deleted file mode 100644 index a450c9147..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java +++ /dev/null @@ -1,202 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.wizards; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.IProjectSetSerializer; -import org.eclipse.team.core.ProjectSetCapability; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.core.RepositoryProviderType; -import org.eclipse.team.core.Team; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.ui.ISharedImages; -import org.eclipse.ui.IExportWizard; -import org.eclipse.ui.IWorkbench; - -public class ProjectSetExportWizard extends Wizard implements IExportWizard { - ExportProjectSetMainPage mainPage; - IStructuredSelection selection; - - public ProjectSetExportWizard() { - setNeedsProgressMonitor(true); - setWindowTitle(Policy.bind("ProjectSetExportWizard.Project_Set_1")); //$NON-NLS-1$ - } - - public void addPages() { - mainPage = new ExportProjectSetMainPage("projectSetMainPage", Policy.bind("ProjectSetExportWizard.Export_a_Project_Set_3"), TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_PROJECTSET_EXPORT_BANNER)); //$NON-NLS-1$ //$NON-NLS-2$ - IProject[] projects = (IProject[])selection.toList().toArray(new IProject[0]); - mainPage.setSelectedProjects(projects); - mainPage.setFileName(ProjectSetImportWizard.lastFile); - addPage(mainPage); - } - public boolean performFinish() { - final boolean[] result = new boolean[] {false}; - try { - getContainer().run(false, false, new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException { - String filename = mainPage.getFileName(); - Path path = new Path(filename); - if (path.getFileExtension() == null) { - filename = filename + ".psf"; //$NON-NLS-1$ - } - ProjectSetImportWizard.lastFile = filename; - File file = new File(filename); - File parentFile = file.getParentFile(); - if (parentFile != null && !parentFile.exists()) { - boolean r = MessageDialog.openQuestion(getShell(), Policy.bind("ProjectSetExportWizard.Question_4"), Policy.bind("ProjectSetExportWizard.Target_directory_does_not_exist._Would_you_like_to_create_it__5")); //$NON-NLS-1$ //$NON-NLS-2$ - if (!r) { - result[0] = false; - return; - } - r = parentFile.mkdirs(); - if (!r) { - MessageDialog.openError(getShell(), Policy.bind("ProjectSetExportWizard.Export_Problems_6"), Policy.bind("ProjectSetExportWizard.An_error_occurred_creating_the_target_directory_7")); //$NON-NLS-1$ //$NON-NLS-2$ - result[0] = false; - return; - } - } - if (file.exists() && file.isFile()) { - boolean r = MessageDialog.openQuestion(getShell(), Policy.bind("ProjectSetExportWizard.Question_8"), Policy.bind("ProjectSetExportWizard.Target_already_exists._Would_you_like_to_overwrite_it__9")); //$NON-NLS-1$ //$NON-NLS-2$ - if (!r) { - result[0] = false; - return; - } - } - - // Hash the projects by provider - IProject[] projects = mainPage.getSelectedProjects(); - Map map = new HashMap(); - for (int i = 0; i < projects.length; i++) { - IProject project = projects[i]; - RepositoryProvider provider = RepositoryProvider.getProvider(project); - if (provider != null) { - String id = provider.getID(); - List list = (List)map.get(id); - if (list == null) { - list = new ArrayList(); - map.put(id, list); - } - list.add(project); - } - } - - Shell shell = getShell(); - - BufferedWriter writer = null; - try { - writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")); //$NON-NLS-1$ - - writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$ - writer.newLine(); - writer.write("<psf version=\"2.0\">"); //$NON-NLS-1$ - writer.newLine(); - - // For each provider id, do the writing - Iterator it = map.keySet().iterator(); - monitor.beginTask(null, 1000 * map.keySet().size()); - while (it.hasNext()) { - String id = (String)it.next(); - writer.write("\t<provider id=\""); //$NON-NLS-1$ - writer.write(id); - writer.write("\">"); //$NON-NLS-1$ - writer.newLine(); - List list = (List)map.get(id); - IProject[] projectArray = (IProject[])list.toArray(new IProject[list.size()]); - IProjectSetSerializer serializer = Team.getProjectSetSerializer(id); - if (serializer != null) { - String[] references = serializer.asReference(projectArray, shell, new SubProgressMonitor(monitor, 990)); - for (int i = 0; i < references.length; i++) { - writer.write("\t\t<project reference=\""); //$NON-NLS-1$ - writer.write(references[i]); - writer.write("\"/>"); //$NON-NLS-1$ - writer.newLine(); - } - } - writer.write("\t</provider>"); //$NON-NLS-1$ - writer.newLine(); - } - writer.write("</psf>"); //$NON-NLS-1$ - writer.newLine(); - result[0] = true; - } catch (IOException e) { - throw new InvocationTargetException(e); - } catch (TeamException e) { - throw new InvocationTargetException(e); - } finally { - if (writer != null) { - try { - writer.close(); - } catch (IOException e) { - throw new InvocationTargetException(e); - } - } - } - - // notify provider types of the project set write - for (Iterator iter = map.keySet().iterator();iter.hasNext();) { - String id = (String) iter.next(); - RepositoryProviderType type = RepositoryProviderType.getProviderType(id); - if (type != null) { - ProjectSetCapability capability = type.getProjectSetCapability(); - if (capability != null) { - capability.projectSetCreated(file, shell, new SubProgressMonitor(monitor, 10)); - } - } - } - - monitor.done(); - } - }); - } catch (InterruptedException e) { - return true; - } catch (InvocationTargetException e) { - Throwable target = e.getTargetException(); - if (target instanceof TeamException) { - ErrorDialog.openError(getShell(), null, null, ((TeamException)target).getStatus()); - return false; - } - if (target instanceof RuntimeException) { - throw (RuntimeException)target; - } - if (target instanceof Error) { - throw (Error)target; - } - } - return result[0]; - } - - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java deleted file mode 100644 index 34e57b626..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.wizards; - -import java.io.*; -import java.lang.reflect.InvocationTargetException; -import java.util.*; - -import javax.xml.parsers.*; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.team.core.*; -import org.eclipse.team.internal.ui.*; -import org.eclipse.team.ui.ISharedImages; -import org.eclipse.ui.*; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -public class ProjectSetImportWizard extends Wizard implements IImportWizard { - ImportProjectSetMainPage mainPage; - public static String lastFile; - - public ProjectSetImportWizard() { - setNeedsProgressMonitor(true); - setWindowTitle(Policy.bind("ProjectSetImportWizard.Project_Set_1")); //$NON-NLS-1$ - } - - public void addPages() { - mainPage = new ImportProjectSetMainPage("projectSetMainPage", Policy.bind("ProjectSetImportWizard.Import_a_Project_Set_3"), TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_PROJECTSET_IMPORT_BANNER)); //$NON-NLS-1$ //$NON-NLS-2$ - mainPage.setFileName(lastFile); - addPage(mainPage); - } - public boolean performFinish() { - - // check if the desired working set exists - final String workingSetName = mainPage.getWorkingSetName(); - if (workingSetName != null) { - IWorkingSet existingSet = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager().getWorkingSet(workingSetName); - if (existingSet != null && - !MessageDialog.openConfirm(getShell(), Policy.bind("ProjectSetImportWizard.workingSetExistsTitle"), Policy.bind("ProjectSetImportWizard.workingSetExistsMessage", workingSetName))) //$NON-NLS-1$ //$NON-NLS-2$ - return false; - } - - final boolean[] result = new boolean[] {false}; - try { - getContainer().run(true, true, new WorkspaceModifyOperation() { - public void execute(IProgressMonitor monitor) throws InvocationTargetException { - InputStreamReader reader = null; - try { - String filename = mainPage.getFileName(); - lastFile = filename; - reader = new InputStreamReader(new FileInputStream(filename), "UTF-8"); //$NON-NLS-1$ - - SAXParserFactory factory = SAXParserFactory.newInstance(); - SAXParser parser = factory.newSAXParser(); - ProjectSetContentHandler handler = new ProjectSetContentHandler(); - InputSource source = new InputSource(reader); - parser.parse(source, handler); - - Map map = handler.getReferences(); - List newProjects = new ArrayList(); - if (map.size() == 0 && handler.isVersionOne()) { - IProjectSetSerializer serializer = Team.getProjectSetSerializer("versionOneSerializer"); //$NON-NLS-1$ - if (serializer != null) { - IProject[] projects = serializer.addToWorkspace(new String[0], filename, getShell(), monitor); - if (projects != null) - newProjects.addAll(Arrays.asList(projects)); - } - } else { - Iterator it = map.keySet().iterator(); - while (it.hasNext()) { - String id = (String)it.next(); - List references = (List)map.get(id); - IProjectSetSerializer serializer = Team.getProjectSetSerializer(id); - if (serializer != null) { - IProject[] projects = serializer.addToWorkspace((String[])references.toArray(new String[references.size()]), filename, getShell(), monitor); - if (projects != null) - newProjects.addAll(Arrays.asList(projects)); - } - } - } - if (workingSetName != null) - createWorkingSet(workingSetName, (IProject[]) newProjects.toArray(new IProject[newProjects.size()])); - result[0] = true; - } catch (IOException e) { - throw new InvocationTargetException(e); - } catch (SAXException e) { - throw new InvocationTargetException(e); - } catch (TeamException e) { - throw new InvocationTargetException(e); - } catch (ParserConfigurationException e) { - throw new InvocationTargetException(e); - } finally { - if (reader != null) { - try { - reader.close(); - } catch (IOException e) { - throw new InvocationTargetException(e); - } - } - } - } - }); - } catch (InterruptedException e) { - return true; - } catch (InvocationTargetException e) { - Throwable target = e.getTargetException(); - if (target instanceof TeamException) { - ErrorDialog.openError(getShell(), null, null, ((TeamException)target).getStatus()); - return false; - } - if (target instanceof RuntimeException) { - throw (RuntimeException)target; - } - if (target instanceof Error) { - throw (Error)target; - } - } - return result[0]; - } - - /* private */ void createWorkingSet(String workingSetName, IProject[] projects) { - IWorkingSetManager manager = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager(); - IWorkingSet oldSet = manager.getWorkingSet(workingSetName); - if (oldSet == null) { - IWorkingSet newSet = manager.createWorkingSet(workingSetName, projects); - manager.addWorkingSet(newSet); - }else { - oldSet.setElements(projects); - } - } - - public void init(IWorkbench workbench, IStructuredSelection selection) { - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/SubscriberRefreshWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/SubscriberRefreshWizard.java deleted file mode 100644 index fdc4fafa7..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/SubscriberRefreshWizard.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.wizards; - -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.ui.ISharedImages; -import org.eclipse.team.ui.TeamImages; -import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant; - -public class SubscriberRefreshWizard extends Wizard { - - private SubscriberParticipant participant; - private GlobalRefreshResourceSelectionPage selectionPage; - - public SubscriberRefreshWizard(SubscriberParticipant participant) { - this.participant = participant; - setWindowTitle(Policy.bind("SubscriberRefreshWizard.0") + participant.getName()); //$NON-NLS-1$ - setDefaultPageImageDescriptor(TeamImages.getImageDescriptor(ISharedImages.IMG_WIZBAN_SHARE)); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.wizard.Wizard#addPages() - */ - public void addPages() { - selectionPage = new GlobalRefreshResourceSelectionPage(participant); - addPage(selectionPage); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.wizard.IWizard#performFinish() - */ - public boolean performFinish() { - IResource[] resources = selectionPage.getSelectedResources(); - if(resources != null) { - participant.refresh(resources); - } - return true; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/TeamWizardPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/TeamWizardPage.java deleted file mode 100644 index a38c5c28d..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/TeamWizardPage.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.wizards; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public abstract class TeamWizardPage extends WizardPage { - /** - * CVSWizardPage constructor comment. - * @param pageName the name of the page - */ - public TeamWizardPage(String pageName) { - super(pageName); - } - /** - * CVSWizardPage constructor comment. - * @param pageName the name of the page - * @param title the title of the page - * @param titleImage the image for the page - */ - public TeamWizardPage(String pageName, String title, ImageDescriptor titleImage) { - super(pageName, title, titleImage); - } - /** - * Creates composite control and sets the default layout data. - * - * @param parent the parent of the new composite - * @param numColumns the number of columns for the new composite - * @return the newly-created coposite - */ - protected Composite createComposite(Composite parent, int numColumns) { - Composite composite = new Composite(parent, SWT.NULL); - - // GridLayout - GridLayout layout = new GridLayout(); - layout.numColumns = numColumns; - composite.setLayout(layout); - - // GridData - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - return composite; - } - /** - * Utility method that creates a label instance - * and sets the default layout data. - * - * @param parent the parent for the new label - * @param text the text for the new label - * @return the new label - */ - protected Label createLabel(Composite parent, String text) { - return createIndentedLabel(parent, text, 0); - } - /** - * Utility method that creates a label instance indented by the specified - * number of pixels and sets the default layout data. - * - * @param parent the parent for the new label - * @param text the text for the new label - * @param indent the indent in pixels, or 0 for none - * @return the new label - */ - protected Label createIndentedLabel(Composite parent, String text, int indent) { - Label label = new Label(parent, SWT.LEFT); - label.setText(text); - GridData data = new GridData(); - data.horizontalSpan = 1; - data.horizontalAlignment = GridData.FILL; - data.horizontalIndent = indent; - label.setLayoutData(data); - return label; - } - /** - * Create a text field specific for this application - * - * @param parent the parent of the new text field - * @return the new text field - */ - protected Text createTextField(Composite parent) { - Text text = new Text(parent, SWT.SINGLE | SWT.BORDER); - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.verticalAlignment = GridData.CENTER; - data.grabExcessVerticalSpace = false; - data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; - text.setLayoutData(data); - return text; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IConfigurationWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IConfigurationWizard.java deleted file mode 100644 index 4f218794f..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IConfigurationWizard.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui; - - -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.ui.IWorkbench; - -/** - * IConfigurationWizard defines the interface that users of the extension - * point org.eclipse.team.ui.configurationWizards must implement. - */ -public interface IConfigurationWizard extends IWizard { - /** - * Initializes this creation wizard using the passed workbench and - * object selection. - * <p> - * This method is called after the no argument constructor and - * before other methods are called. - * </p> - * - * @param workbench the current workbench - * @param project the selected project - */ - void init(IWorkbench workbench, IProject project); -} - diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java deleted file mode 100644 index 81e612616..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui; - -/** - * Images that are available for providers to re-use. They include - * common overlays and wizard images. A provider can use their own - * custom images, these shared images are only available for - * convenience. - */ -public interface ISharedImages { - public final String IMG_DIRTY_OVR = "ovr/dirty_ov.gif"; //$NON-NLS-1$ - public final String IMG_CHECKEDIN_OVR = "ovr/version_controlled.gif"; //$NON-NLS-1$ - public final String IMG_CHECKEDOUT_OVR = "ovr/checkedout_ov.gif"; //$NON-NLS-1$ - public final String IMG_CONFLICT_OVR = "ovr/confchg_ov.gif"; //$NON-NLS-1$ - - public final String IMG_COLLAPSE_ALL = "clcl16/collapseall.gif"; //$NON-NLS-1$ - public final String IMG_COLLAPSE_ALL_ENABLED = "elcl16/collapseall.gif"; //$NON-NLS-1$ - - public final String IMG_SYNC_VIEW = "cview16/synch_synch.gif"; //$NON-NLS-1$ - public final String IMG_COMPARE_VIEW = "cview16/compare_view.gif"; //$NON-NLS-1$ - - // local toolbars (colour) - public final String IMG_DLG_SYNC_INCOMING = "clcl16/incom_synch.gif"; //$NON-NLS-1$ - public final String IMG_DLG_SYNC_OUTGOING = "clcl16/outgo_synch.gif"; //$NON-NLS-1$ - public final String IMG_DLG_SYNC_CONFLICTING = "clcl16/conflict_synch.gif"; //$NON-NLS-1$ - public final String IMG_REFRESH = "clcl16/refresh.gif"; //$NON-NLS-1$ - public final String IMG_IGNORE_WHITESPACE = "clcl16/ignorews_edit.gif"; //$NON-NLS-1$ - public final String IMG_CONTENTS = "clcl16/contents.gif"; //$NON-NLS-1$ - - // local toolbars (disabled) - public final String IMG_DLG_SYNC_INCOMING_DISABLED = "dlcl16/incom_synch.gif"; //$NON-NLS-1$ - public final String IMG_DLG_SYNC_OUTGOING_DISABLED = "dlcl16/outgo_synch.gif"; //$NON-NLS-1$ - public final String IMG_DLG_SYNC_CONFLICTING_DISABLED = "dlcl16/conflict_synch.gif"; //$NON-NLS-1$ - public final String IMG_REFRESH_DISABLED = "dlcl16/refresh.gif"; //$NON-NLS-1$ - public final String IMG_IGNORE_WHITESPACE_DISABLED = "dlcl16/ignorews_edit.gif"; //$NON-NLS-1$ - public final String IMG_CONTENTS_DISABLED = "dlcl16/contents.gif"; //$NON-NLS-1$ - - // local toolbars (enabled) - public final String IMG_DLG_SYNC_INCOMING_ENABLED = "elcl16/incom_synch.gif"; //$NON-NLS-1$ - public final String IMG_DLG_SYNC_OUTGOING_ENABLED = "elcl16/outgo_synch.gif"; //$NON-NLS-1$ - public final String IMG_DLG_SYNC_CONFLICTING_ENABLED = "elcl16/conflict_synch.gif"; //$NON-NLS-1$ - public final String IMG_REFRESH_ENABLED = "elcl16/refresh.gif"; //$NON-NLS-1$ - public final String IMG_IGNORE_WHITESPACE_ENABLED = "elcl16/ignorews_edit.gif"; //$NON-NLS-1$ - public final String IMG_CONTENTS_ENABLED = "elcl16/contents.gif"; //$NON-NLS-1$ - - // sync view modes - public final String IMG_SYNC_MODE_CATCHUP = "clcl16/catchup_rls.gif"; //$NON-NLS-1$ - public final String IMG_SYNC_MODE_RELEASE = "clcl16/release_rls.gif"; //$NON-NLS-1$ - public final String IMG_SYNC_MODE_FREE = "clcl16/catchuprelease_rls.gif"; //$NON-NLS-1$ - - // sync view modes (disabled) - public final String IMG_SYNC_MODE_CATCHUP_DISABLED = "dlcl16/catchup_rls.gif"; //$NON-NLS-1$ - public final String IMG_SYNC_MODE_RELEASE_DISABLED = "dlcl16/release_rls.gif"; //$NON-NLS-1$ - public final String IMG_SYNC_MODE_FREE_DISABLED = "dlcl16/catchuprelease_rls.gif"; //$NON-NLS-1$ - - // sync view modes (enabled) - public final String IMG_SYNC_MODE_CATCHUP_ENABLED = "elcl16/catchup_rls.gif"; //$NON-NLS-1$ - public final String IMG_SYNC_MODE_RELEASE_ENABLED = "elcl16/release_rls.gif"; //$NON-NLS-1$ - public final String IMG_SYNC_MODE_FREE_ENABLED = "elcl16/catchuprelease_rls.gif"; //$NON-NLS-1$ - - // wizard banners - public final String IMG_WIZBAN_SHARE = "wizban/share_wizban.gif"; //$NON-NLS-1$ - public final String IMG_PROJECTSET_IMPORT_BANNER = "wizban/import_projectset_wizban.gif"; //$NON-NLS-1$ - public final String IMG_PROJECTSET_EXPORT_BANNER = "wizban/export_projectset_wizban.gif"; //$NON-NLS-1$ - - //objects - public final String IMG_SITE_ELEMENT = "clcl16/site_element.gif"; //$NON-NLS-1$ - public final String IMG_CHANGE_FILTER = "clcl16/change_filter.gif"; //$NON-NLS-1$ - public final String IMG_COMPRESSED_FOLDER = "obj/compressed_folder_obj.gif"; //$NON-NLS-1$ - public final String IMG_WARNING = "ovr/warning_co.gif"; //$NON-NLS-1$ - -} - diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ITeamUIConstants.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ITeamUIConstants.java deleted file mode 100644 index 0aa50c41b..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ITeamUIConstants.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui; - -public interface ITeamUIConstants { - - // extension points - public static final String PT_SYNCPARTICIPANTS = "synchronizeParticipants"; //$NON-NLS-1$ - public static final String PT_CONFIGURATION ="configurationWizards"; //$NON-NLS-1$ - public static final String PT_TARGETCONFIG ="targetConfigWizards"; //$NON-NLS-1$ - public static final String PT_LOGICAL_VIEWS = "logicalViews"; //$NON-NLS-1$ -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamImages.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamImages.java deleted file mode 100644 index 5af378995..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamImages.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui; - -import org.eclipse.core.runtime.IExtension; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.team.internal.ui.TeamUIPlugin; - -/** - * TeamImages provides convenience methods for accessing shared images - * provided by the org.eclipse.team.ui plug-in. - * <p> - * This class provides <code>Image</code> and <code>ImageDescriptor</code>s - * for each named image in the interface. All <code>Image</code> objects provided - * by this class are managed by this class and must never be disposed - * by other clients. - * </p> - */ -public class TeamImages { - /** - * Returns the image descriptor for the given image ID. - * Returns null if there is no such image. - * - * @param id the identifier for the image to retrieve - * @return the image associated with the given ID - */ - public static ImageDescriptor getImageDescriptor(String id) { - return TeamUIPlugin.getImageDescriptor(id); - } - /** - * Convenience method to get an image descriptor for an extension - * - * @param extension the extension declaring the image - * @param subdirectoryAndFilename the path to the image - * @return the image - */ - public static ImageDescriptor getImageDescriptorFromExtension(IExtension extension, String subdirectoryAndFilename) { - return TeamUIPlugin.getImageDescriptorFromExtension(extension, subdirectoryAndFilename); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java deleted file mode 100644 index 29a752129..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui; - -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.synchronize.SynchronizeManager; -import org.eclipse.team.ui.synchronize.ISynchronizeManager; - -/** - * TeamUI contains public API for generic UI-based Team functionality - */ -public class TeamUI { - - // manages synchronize participants - private static ISynchronizeManager synchronizeManager; - - /** - * Property constant indicating the global ignores list has changed. - */ - public static String GLOBAL_IGNORES_CHANGED = TeamUIPlugin.ID + "global_ignores_changed"; //$NON-NLS-1$ - - /** - * Return the synchronize manager. - * - * @return the synchronize manager - * @since 3.0 - */ - public static ISynchronizeManager getSynchronizeManager() { - if (synchronizeManager == null) { - synchronizeManager = new SynchronizeManager(); - } - return synchronizeManager; - } - - /** - * Register for changes made to Team properties. - * - * @param listener the listener to add - */ - public static void addPropertyChangeListener(IPropertyChangeListener listener) { - TeamUIPlugin.addPropertyChangeListener(listener); - } - - /** - * Deregister as a Team property changes. - * - * @param listener the listener to remove - */ - public static void removePropertyChangeListener(IPropertyChangeListener listener) { - TeamUIPlugin.removePropertyChangeListener(listener); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/package.html b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/package.html deleted file mode 100644 index 8a222f458..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/package.html +++ /dev/null @@ -1,21 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> - <meta name="Author" content="IBM"> - <title>Package-level Javadoc</title> -</head> -<body> -Provides basic support for managing Team providers. -<h2>Package Specification</h2> -<p>This package specifies the API for integrating Team support plug-ins into -the workbench. This support includes:</p> -<ul> -<li>A set of common images for enabling a common Team look in the workbench. -<li>A configuration wizard extension for allowing Team providers to associate their -provider with a project in the workspace. -<li>A synchronization infrastructure to allow Team providers to extend or participate -in the Synchronize View. -</ul> -</body> -</html>
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java deleted file mode 100644 index 8abc0d516..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java +++ /dev/null @@ -1,244 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize; - -import org.eclipse.core.runtime.*; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.util.*; -import org.eclipse.jface.viewers.IBasicPropertyConstants; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.registry.SynchronizeParticipantDescriptor; -import org.eclipse.team.ui.TeamImages; -import org.eclipse.team.ui.TeamUI; -import org.eclipse.ui.IMemento; -import org.eclipse.ui.PartInitException; - -/** - * AbstractSynchronizeParticipant is the abstract base class for all - * synchronize view participants. It provides default lifecycle support - * for participants. - * - * @see ISynchronizeParticipant - * @since 3.0 - */ -public abstract class AbstractSynchronizeParticipant implements ISynchronizeParticipant { - // property listeners - private ListenerList fListeners; - - private String fName; - private String fId; - private ImageDescriptor fImageDescriptor; - protected IConfigurationElement configElement; - - /** - * Notifies listeners of property changes, handling any exceptions - */ - class PropertyNotifier implements ISafeRunnable { - - private IPropertyChangeListener fListener; - private PropertyChangeEvent fEvent; - - /** - * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable) - */ - public void handleException(Throwable exception) { - TeamUIPlugin.log(IStatus.ERROR, Policy.bind("AbstractSynchronizeParticipant.5"), exception); //$NON-NLS-1$ - } - - /** - * @see org.eclipse.core.runtime.ISafeRunnable#run() - */ - public void run() throws Exception { - fListener.propertyChange(fEvent); - } - - /** - * Notifies listeners of the property change - * - * @param property - * the property that has changed - */ - public void notify(PropertyChangeEvent event) { - if (fListeners == null) { - return; - } - fEvent = event; - Object[] copiedListeners = fListeners.getListeners(); - for (int i = 0; i < copiedListeners.length; i++) { - fListener = (IPropertyChangeListener) copiedListeners[i]; - Platform.run(this); - } - fListener = null; - } - } - - public AbstractSynchronizeParticipant() { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.console.IConsole#getName() - */ - public String getName() { - return fName; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.console.IConsole#getImageDescriptor() - */ - public ImageDescriptor getImageDescriptor() { - return fImageDescriptor; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.team.ui.sync.ISynchronizeParticipant#getId() - */ - public String getId() { - return fId; - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#isPersistent() - */ - public boolean isPersistent() { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#doesSupportRefresh() - */ - public boolean doesSupportSynchronize() { - ISynchronizeParticipantDescriptor d = TeamUI.getSynchronizeManager().getParticipantDescriptor(getId()); - return d == null ? false : d.doesSupportRefresh(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.console.IConsole#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) - */ - public void addPropertyChangeListener(IPropertyChangeListener listener) { - if (fListeners == null) { - fListeners = new ListenerList(); - } - fListeners.add(listener); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.console.IConsole#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) - */ - public void removePropertyChangeListener(IPropertyChangeListener listener) { - if (fListeners != null) { - fListeners.remove(listener); - } - } - - /** - * Notify all listeners that the given property has changed. - * - * @param source - * the object on which a property has changed - * @param property - * identifier of the property that has changed - * @param oldValue - * the old value of the property, or <code>null</code> - * @param newValue - * the new value of the property, or <code>null</code> - */ - public void firePropertyChange(Object source, String property, Object oldValue, Object newValue) { - if (fListeners == null) { - return; - } - PropertyNotifier notifier = new PropertyNotifier(); - notifier.notify(new PropertyChangeEvent(source, property, oldValue, newValue)); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, - * java.lang.String, java.lang.Object) - */ - public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { - // Save config element. - configElement = config; - - // Id - fId = config.getAttribute("id"); //$NON-NLS-1$ - - // Title. - fName = config.getAttribute("name"); //$NON-NLS-1$ - if (config == null) { - fName = "Unknown"; //$NON-NLS-1$ - } - - // Icon. - String strIcon = config.getAttribute("icon"); //$NON-NLS-1$ - if (strIcon != null) { - fImageDescriptor = TeamImages.getImageDescriptorFromExtension(configElement.getDeclaringExtension(), strIcon); - } - } - - protected void setInitializationData(ISynchronizeParticipantDescriptor descriptor) throws CoreException { - if(descriptor instanceof SynchronizeParticipantDescriptor) { - setInitializationData(((SynchronizeParticipantDescriptor)descriptor).getConfigurationElement(), null, null); - } else { - throw new TeamException(Policy.bind("AbstractSynchronizeParticipant.4")); //$NON-NLS-1$ - } - } - - /** - * Sets the name of this console to the specified value and notifies - * property listeners of the change. - * - * @param name - * the new name - */ - protected void setName(String name) { - String old = fName; - fName = name; - firePropertyChange(this, IBasicPropertyConstants.P_TEXT, old, name); - } - - /** - * Sets the image descriptor for this console to the specified value and - * notifies property listeners of the change. - * - * @param imageDescriptor - * the new image descriptor - */ - protected void setImageDescriptor(ImageDescriptor imageDescriptor) { - ImageDescriptor old = fImageDescriptor; - fImageDescriptor = imageDescriptor; - firePropertyChange(this, IBasicPropertyConstants.P_IMAGE, old, imageDescriptor); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#init(org.eclipse.ui.IMemento) - */ - public void init(IMemento memento) throws PartInitException { - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#saveState(org.eclipse.ui.IMemento) - */ - public void saveState(IMemento memento) { - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java deleted file mode 100644 index e796751df..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize; - - -/** - * Manages synchronization view participants. Clients can programatically add - * or remove participants via this manager. - * <p> - * Clients are not intended to implement this interface. - * </p> - * @see ISynchronizeParticipant - * @since 3.0 - */ -public interface ISynchronizeManager { - /** - * Registers the given listener for participant notifications. Has - * no effect if an identical listener is already registered. - * - * @param listener listener to register - */ - public void addSynchronizeParticipantListener(ISynchronizeParticipantListener listener); - - /** - * Deregisters the given listener for participant notifications. Has - * no effect if an identical listener is not already registered. - * - * @param listener listener to deregister - */ - public void removeSynchronizeParticipantListener(ISynchronizeParticipantListener listener); - - /** - * Adds the given participants to the synchronize manager. Has no effect for - * equivalent participants are already registered. The participants will be added - * to any existing synchronize views. - * - * @param consoles consoles to add - */ - public void addSynchronizeParticipants(ISynchronizeParticipant[] participants); - - /** - * Removes the given participants from the synchronize manager. If the participants are - * being displayed in any synchronize views, the associated pages will be closed. - * - * @param consoles consoles to remove - */ - public void removeSynchronizeParticipants(ISynchronizeParticipant[] participants); - - /** - * Returns a collection of synchronize participants registered with the synchronize manager. - * - * @return a collection of synchronize participants registered with the synchronize manager. - */ - public ISynchronizeParticipant[] getSynchronizeParticipants(); - - /** - * Opens the synchronize views in the perspective defined by the user in the team synchronize - * perferences. - * - * @return the opened synchronize view or <code>null</code> if it can't be opened. - */ - public ISynchronizeView showSynchronizeViewInActivePage(); - - /** - * Returns the registered synchronize participants with the given id. It is - * possible to have multiple instances of the same participant type. - * - * @return the registered synchronize participants with the given id, or - * <code>null</code> if none with that id is not registered. - */ - public ISynchronizeParticipant[] find(String id); - - /** - * Returns the participant descriptor for the given participant id or - * <code>null</code> if a descriptor is not found for that id. - * - * @return the participant descriptor for the given participant id or - * <code>null</code> if a descriptor is not found for that id. - */ - public ISynchronizeParticipantDescriptor getParticipantDescriptor(String id); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java deleted file mode 100644 index 1e583180d..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipant.java +++ /dev/null @@ -1,183 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize; - -import org.eclipse.core.runtime.IExecutableExtension; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.ui.IMemento; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.part.IPageBookViewPage; - -/** - * A synchronize participant is shown in the <code>Synchronize View</code>. Typically - * a participant will show changes between local resources and variant states of - * those resources. For example, a participant could show the relative synchronization - * between local resources and those on an FTP server, or alternatively, between local - * resources and local history. - * <p> - * A participant is added to the Synchronize View in three steps: - * <ol> - * <li>A <code>synchronizeParticipant</code> extension is contributed to - * the team registry. This extension defines the participant id, - * name, icon, type, and participant class.</li> - * <li>The participant is included in the Synchronize View when the view is - * created if its type is <code>static</code>.</li> - * <li>If a participant is not static, plug-in developers can add the - * participant to the view by adding the participant via - * {@link ISynchronizeManager#addSynchronizeParticipants(ISynchronizeParticipant[]) and - * remove it using {@link ISynchronizeManager#removeSynchronizeParticipants(ISynchronizeParticipant[]). - * </ol> - * </p> - * <p> - * A participant must create a page that will be displayed in the ISynchronizeView page - * book view. - * </p><p> - * Clients may implement this interface. - * </p> - * @see ISynchronizeView - * @see ISynchronizeManager - * @since 3.0 - */ -public interface ISynchronizeParticipant extends IExecutableExtension { - /** - * Returns the unique id that identified the <i>type</i> of this - * synchronize participant. The synchronize manager supports registering - * several instances of the same participant type. - * - * @return the unique id that identified the <i>type</i> of this - * synchronize participant. - */ - public String getId(); - - /** - * Returns the name of this synchronize participant. - * - * @return the name of this synchronize participant - */ - public String getName(); - - /** - * Returns <code>true</code> if this participant should be persisted between - * workbench sessions and <code>false</code> otherwise. - * - * @return <code>true</code> if this participant should be persisted between - * workbench sessions and <code>false</code> otherwise. - */ - public boolean isPersistent(); - - /** - * Returns an image descriptor for this synchronize participant, or <code>null</code> - * if none. - * - * @return an image descriptor for this synchronize participant, or <code>null</code> - * if none - */ - public ImageDescriptor getImageDescriptor(); - - /** - * Creates and returns a new page for this synchronize participant. The - * page is displayed for this synchronize participant in the given - * synchronize view. - * - * @param view the view in which the page is to be created - * @return a page book view page representation of this synchronize - * participant - */ - public IPageBookViewPage createPage(ISynchronizeView view); - - /** - * Creates and returns a wizard page used to globally synchronize this participant. Participants - * returning a wizard will get added to the global Team synchronize action and users can - * easily initiate a synchronization on the participant. The implementor can decide exactly - * what information is needed from the user to synchronize. - * - * @return a wizard that prompts the user for information necessary to synchronize this - * participant or <code>null</code> if this participant doesn't want to support global refresh. - */ - public IWizard createSynchronizeWizard(); - - /** - * Returns if this participant supports a global synchronize action and will return a wizard - * if {@link #createSynchronizeWizard()} is called. - * - * @return <code>true</code> if this participant supports a global synchronize action and - * <code>false</code> otherwise. - */ - public boolean doesSupportSynchronize(); - - /** - * Initializes this participant with the given participant state. - * A memento is passed to the participant which contains a snapshot - * of the participants state from a previous session. - * <p> - * This method is automatically called by the team plugin shortly after - * participant construction. It marks the start of the views's - * lifecycle. Clients must not call this method. - * </p> - * @param memento the participant state or <code>null</code> if there - * is no previous saved state - * @exception PartInitException if this participant was not initialized - * successfully - */ - public void init(IMemento memento) throws PartInitException; - - /** - * Disposes of this synchronize participant. This is the last method called - * on the <code>ISynchronizeParticipant</code>. It marks the end of the - * participants lifecycle. - * </p> - * <p> - * Within this method a participant may release any resources, fonts, images, etc. - * held by this part. It is also very important to deregister all listeners. - * </p> - * <p> - * Clients should not call this method (the synchronize manager calls this - * method at appropriate times). - * </p> - */ - public void dispose(); - - /** - * Saves the participants object state within the memento. This state - * will be available when the participant is restored via <code>init</code>. - * @param memento a memento to receive the object state - */ - public void saveState(IMemento memento); - - /** - * Adds a listener for changes to properties of this synchronize - * participant. Has no effect if an identical listener is already - * registered. - * <p> - * The changes supported by the synchronize view are as follows: - * <ul> - * <li><code>IBasicPropertyConstants.P_TEXT</code>- indicates the name - * of a synchronize participant has changed</li> - * <li><code>IBasicPropertyConstants.P_IMAGE</code>- indicates the - * image of a synchronize participant has changed</li> - * </ul></p> - * <p> - * Clients may define additional properties as required. - * </p> - * @param listener a property change listener - */ - public void addPropertyChangeListener(IPropertyChangeListener listener); - - /** - * Removes the given property listener from this synchronize participant. - * Has no effect if an identical listener is not alread registered. - * - * @param listener a property listener - */ - public void removePropertyChangeListener(IPropertyChangeListener listener); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.java deleted file mode 100644 index 0cfbed6f5..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantDescriptor.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize; - -import org.eclipse.jface.resource.ImageDescriptor; - -/** - * A participant descriptor contains the content of the - * <code>synchronizeParticipants</code> extension section for - * for a registered participant type in the declaring plug-in's - * manifest (<code>plugin.xml</code>) file. - * <p> - * Clients are not intended to implement this interface. - * </p> - * @see ISynchronizeManager#getParticipantDescriptor(String) - * @since 3.0 - */ -public interface ISynchronizeParticipantDescriptor { - /** - * Returns the name of this participant. This can be shown to the user. - * - * @return the name of this participant. This can be shown to the user. - */ - public String getName(); - - /** - * Returns a string describing this participant type. - * - * @return a string describing this participant type. - */ - public String getDescription(); - - /** - * Returns the unique id that identifies this participant type. - * - * @return the unique id that identifies this participant type. - */ - public String getId(); - - /** - * Returns the image descriptor for this participant type. - * - * @return the image descriptor for this participant type. - */ - public ImageDescriptor getImageDescriptor(); - - /** - * Returns <code>true</code> if the participant is static and - * <code>false</code> otherwise. Static participants are created - * automatically by the synchronize manager at startup whereas - * not static participants are created by client code and registered - * with the manager. - * - * @return <code>true</code> if the participant is static and - * <code>false</code> otherwise - */ - public boolean isStatic(); - - /** - * Returns if this participant supports a global refresh action. - * - * @return if this participant supports a global refresh action. - */ - public boolean doesSupportRefresh(); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantListener.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantListener.java deleted file mode 100644 index 6dde603ae..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeParticipantListener.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize; - -/** - * A synchronize participant listener is notified when participants are added or - * removed from the synchronize manager. - * <p> - * Clients may implement this interface. - * </p> - * @since 3.0 - */ -public interface ISynchronizeParticipantListener { - /** - * Notification the given participants have been added to the synchronize - * manager. - * - * @param participants added participants - */ - public void participantsAdded(ISynchronizeParticipant[] participants); - - /** - * Notification the given participants have been removed from the - * synchronize manager. - * - * @param participants removed participants - */ - public void participantsRemoved(ISynchronizeParticipant[] participants); - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java deleted file mode 100644 index 387158033..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeView.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize; - -import org.eclipse.ui.IViewPart; - -/** - * A view that displays synchronization participants that are registered with the - * synchronize manager. This is essentially a generic container that allows - * multiple {@link ISynchronizeParticipant} implementations to share the same - * view. The only behavior provided by the view is a mechanism for switching - * between participants. - * <p> - * Clients should not add viewActions to this view because they will be global - * to all participants. Instead, add participant specific actions as described - * in {@link StructuredViewerAdvisor}. - * </p> - * <p> - * Clients are not intended to implement this interface. - * </p> - * @see ISynchronizeManager - * @since 3.0 - */ -public interface ISynchronizeView extends IViewPart { - /** - * The id for this view - */ - public static final String VIEW_ID = "org.eclipse.team.sync.views.SynchronizeView"; //$NON-NLS-1$ - - /** - * Displays the given synchronize participant in the Synchronize View. This - * has no effect if this participant is already being displayed. - * - * @param participant participant to be displayed, cannot be <code>null</code> - */ - public void display(ISynchronizeParticipant participant); - - /** - * Returns the participant currently being displayed in the Synchronize View - * or <code>null</code> if none. - * - * @return the participant currently being displayed in the Synchronize View - * or <code>null</code> if none - */ - public ISynchronizeParticipant getParticipant(); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/package.html b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/package.html deleted file mode 100644 index b40bd2f51..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/package.html +++ /dev/null @@ -1,47 +0,0 @@ -<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en"> -<html> -<head> - <meta content="text/html; charset=iso-8859-1" - http-equiv="Content-Type"> - <meta content="IBM" name="Author"> - <title>Package-level Javadoc</title> -</head> -<body> -<p>Application programming interfaces for interaction -with the Eclipse Synchronize View.</p> -<h2>Package Specification</h2> -<p>The Eclipse Team UI plug-in provides a set of classes and interfaces -to support a generic synchronize view that can show multiple -synchronize participants. This package contains a generic abstract -synchronize participant that provides the common functionality for -synchronize participants. The basic model for the Synchronize View APIs -is the following:</p> -<ul> - <li>A ISynchronizeManager manages registered synchronize -participants. There can be several instances of the same participant -type.</li> - <li>A ISynchronizeParticipant is a logical representation of a -connection between workspace resources and a remote location used to -shared those resources.</li> - <li>A ISynchronizeView is a page book view of participants.</li> - <li>A ISynchronizeParticipant must create a page that will be -displayed in the ISynchronizeView page book view.</li> - <li>The ISynchronizeView shows a drop-down of all registered -participants and allows switching between them.</li> - <li>A ISynchronizeParticipant can contribute actions to the toolbar, -menus, and view menu.</li> -</ul> -<p>Synchronize participants are declared by extending the <strong>synchronizeParticipants -</strong>extension point. There are two classes of synchronize -participants: <em>static </em>participants will be created when the -synchronize view is created, and <em>dynamic</em> participants that -are created by user code at some other time. A synchronize manager (<b>ISynchronizeManager</b>) -manages all active synchronize participants, and provides notification -of participants which are added and removed. Participants are displayed -in a page book view. Each participant implementation is reponsible for -creating its page (<b>IPageBookView</b>), which provides freedom of -presentation to the synchronize view implementation. A single -participant may be displayed simultaneously in multiple synchronize -views, and in different workbench windows.</p> -</body> -</html> diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/DirectionFilterActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/DirectionFilterActionGroup.java deleted file mode 100644 index 3b76316c2..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/DirectionFilterActionGroup.java +++ /dev/null @@ -1,176 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize.subscriber; - -import java.util.*; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.actions.ActionGroup; - -/** - * This ActionGroup provides filtering of a sync set by change direction. - * The actions are presented to the user as toolbar buttons where only one - * button is active at a time. - * <p> - * When a modes changes a property change event is fired from the participant - * with a value of <code>SubscriberParticipant.P_SYNCVIEWPAGE_MODE</code>. - * </p> - * @see SubscriberParticipant - * @since 3.0 - */ -public class DirectionFilterActionGroup extends ActionGroup implements IPropertyChangeListener { - - // An array of the selection actions for the modes (indexed by mode constant) - private List actions = new ArrayList(3); - - private DirectionFilterAction incomingMode; - private DirectionFilterAction outgoingMode; - private DirectionFilterAction bothMode; - private DirectionFilterAction conflictsMode; - private SubscriberParticipant page; - - private int supportedModes; - - class DirectionFilterAction extends Action { - private int modeId; - - public DirectionFilterAction(String prefix,String commandId, int modeId) { - super("", AS_RADIO_BUTTON); //$NON-NLS-1$ - this.modeId = modeId; - Utils.initAction(this, prefix, Policy.getBundle()); - Action a = new Action() { - public void run() { - DirectionFilterAction.this.run(); - } - }; - } - public void run() { - // checkMode() is called because programatic checking of radio buttons doesn't - // consider radio buttons, hence breaks the radio-button behavior. As a workaround - // we have to manually check/uncheck the set instead. - //checkMode(modeId); - if(isChecked()) { - page.setMode(modeId); - } - } - public int getModeId() { - return modeId; - } - } - - /** - * Creates a direction filter group with the given supported modes. The - * possible values for modes are defined by the {@link SubscriberParticipant} - * class. - * - * @see SubscriberParticipant#BOTH_MODE - * @see SubscriberParticipant#OUTGOING_MODE - * @see SubscriberParticipant#INCOMING_MODE - * @see SubscriberParticipant#CONFLICTING_MODE - * @see SubscriberParticipant#ALL_MODES - * - * @param participant the participant showing this group - * @param supportedModes the modes to be shown - */ - public DirectionFilterActionGroup(SubscriberParticipant participant, int supportedModes) { - this.supportedModes = supportedModes; - this.page = participant; - createActions(); - participant.addPropertyChangeListener(this); - checkMode(participant.getMode()); - } - - /** - * Sets up the sync modes and the actions for switching between them. - */ - private void createActions() { - // Create the actions - if((supportedModes & SubscriberParticipant.INCOMING_MODE) != 0) { - incomingMode = new DirectionFilterAction("action.directionFilterIncoming.", "org.eclipse.team.ui.syncview.incomingFilter", SubscriberParticipant.INCOMING_MODE); //$NON-NLS-1$ //$NON-NLS-2$ - actions.add(incomingMode); - } - - if((supportedModes & SubscriberParticipant.OUTGOING_MODE) != 0) { - outgoingMode = new DirectionFilterAction("action.directionFilterOutgoing.", "org.eclipse.team.ui.syncview.outgoingFilter", SubscriberParticipant.OUTGOING_MODE); //$NON-NLS-1$ //$NON-NLS-2$ - actions.add(outgoingMode); - } - - if((supportedModes & SubscriberParticipant.BOTH_MODE) != 0) { - bothMode = new DirectionFilterAction("action.directionFilterBoth.", "org.eclipse.team.ui.syncview.bothFilter", SubscriberParticipant.BOTH_MODE); //$NON-NLS-1$ //$NON-NLS-2$ - actions.add(bothMode); - } - - if((supportedModes & SubscriberParticipant.CONFLICTING_MODE) != 0) { - conflictsMode = new DirectionFilterAction("action.directionFilterConflicts.", "org.eclipse.team.ui.syncview.conflictsFilter", SubscriberParticipant.CONFLICTING_MODE); //$NON-NLS-1$ //$NON-NLS-2$ - actions.add(conflictsMode); - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars) - */ - public void fillActionBars(IActionBars actionBars, String group) { - super.fillActionBars(actionBars); - IToolBarManager toolBar = actionBars.getToolBarManager(); - for (Iterator it = actions.iterator(); it.hasNext();) { - DirectionFilterAction action = (DirectionFilterAction) it.next(); - if(group != null) { - toolBar.appendToGroup(group, action); - } else { - toolBar.add(action); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars) - */ - public void fillToolBar(IToolBarManager toolBar) { - for (Iterator it = actions.iterator(); it.hasNext();) { - DirectionFilterAction action = (DirectionFilterAction) it.next(); - toolBar.add(action); - } - } - - private void checkMode(int mode) { - for (Iterator it = actions.iterator(); it.hasNext();) { - DirectionFilterAction action = (DirectionFilterAction)it.next(); - if(action.getModeId() == mode) { - action.setChecked(true); - } else { - action.setChecked(false); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent event) { - if(event.getProperty().equals(SubscriberParticipant.P_SYNCVIEWPAGE_MODE)) { - Integer mode = (Integer)event.getNewValue(); - checkMode(mode.intValue()); - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.actions.ActionGroup#dispose() - */ - public void dispose() { - super.dispose(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/IRefreshEvent.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/IRefreshEvent.java deleted file mode 100644 index 995db2767..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/IRefreshEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize.subscriber; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.team.core.subscribers.Subscriber; -import org.eclipse.team.core.synchronize.SyncInfo; - -public interface IRefreshEvent { - public static final int SCHEDULED_REFRESH = 1; - - public static final int USER_REFRESH = 2; - - public int getRefreshType(); - - public Subscriber getSubscriber(); - - public SyncInfo[] getChanges(); - - public long getStartTime(); - - public long getStopTime(); - - public IStatus getStatus(); - - public IResource[] getResources(); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/IRefreshSubscriberListener.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/IRefreshSubscriberListener.java deleted file mode 100644 index ef57f1b5f..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/IRefreshSubscriberListener.java +++ /dev/null @@ -1,16 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize.subscriber; - -public interface IRefreshSubscriberListener { - public void refreshStarted(IRefreshEvent event); - public void refreshDone(IRefreshEvent event); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/RefreshAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/RefreshAction.java deleted file mode 100644 index 5ff05a326..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/RefreshAction.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize.subscriber; - -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.*; -import org.eclipse.team.core.subscribers.SubscriberSyncInfoCollector; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.team.internal.ui.jobs.RefreshSubscriberJob; -import org.eclipse.ui.IWorkbenchSite; - -/** - * A general refresh action that will refresh a subscriber in the background. - * - * @since 3.0 - */ -public class RefreshAction extends Action { - - private ISelectionProvider selectionProvider; - private boolean refreshAll; - private SubscriberSyncInfoCollector collector; - private IRefreshSubscriberListener listener; - private String description; - private IWorkbenchSite workbenchSite; - - public RefreshAction(ISelectionProvider page, String description, SubscriberSyncInfoCollector collector, IRefreshSubscriberListener listener, boolean refreshAll) { - this.selectionProvider = page; - this.description = description; - this.collector = collector; - this.listener = listener; - this.refreshAll = refreshAll; - Utils.initAction(this, "action.refreshWithRemote."); //$NON-NLS-1$ - } - - public void run() { - ISelection selection = selectionProvider.getSelection(); - if(selection instanceof IStructuredSelection) { - IResource[] resources = Utils.getResources(((IStructuredSelection)selection).toArray()); - if (refreshAll || resources.length == 0) { - // If no resources are selected, refresh all the subscriber roots - resources = collector.getRoots(); - } - run(getWorkbenchSite(), description, resources, collector, listener); - } - } - - /** - * Policy.bind("SyncViewRefresh.taskName"); - * - * @param site - * @param taskName - * @param description - * @param resources - * @param collector - * @param listener - */ - public static void run(IWorkbenchSite site, String taskName, IResource[] resources, final SubscriberSyncInfoCollector collector, final IRefreshSubscriberListener listener) { - RefreshSubscriberJob job = new RefreshSubscriberJob(taskName, resources, collector); //$NON-NLS-1$ - IRefreshSubscriberListener autoListener = new IRefreshSubscriberListener() { - public void refreshStarted(IRefreshEvent event) { - if(listener != null) { - listener.refreshStarted(event); - } - } - public void refreshDone(IRefreshEvent event) { - if(listener != null) { - listener.refreshDone(event); - RefreshSubscriberJob.removeRefreshListener(this); - } - } - }; - - if (listener != null) { - RefreshSubscriberJob.addRefreshListener(autoListener); - } - Utils.schedule(job, site); - } - - public void setWorkbenchSite(IWorkbenchSite part) { - this.workbenchSite = part; - } - - public IWorkbenchSite getWorkbenchSite() { - return workbenchSite; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipant.java deleted file mode 100644 index 1f503660e..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipant.java +++ /dev/null @@ -1,328 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize.subscriber; - -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.team.core.subscribers.Subscriber; -import org.eclipse.team.core.subscribers.SubscriberSyncInfoCollector; -import org.eclipse.team.core.synchronize.FastSyncInfoFilter; -import org.eclipse.team.core.synchronize.SyncInfo; -import org.eclipse.team.internal.ui.*; -import org.eclipse.team.internal.ui.jobs.RefreshUserNotificationPolicy; -import org.eclipse.team.internal.ui.wizards.SubscriberRefreshWizard; -import org.eclipse.team.ui.TeamUI; -import org.eclipse.team.ui.synchronize.*; -import org.eclipse.ui.*; -import org.eclipse.ui.part.IPageBookViewPage; - -/** - * A synchronize participant that displays synchronization information for local - * resources that are managed via a {@link Subscriber}. - * - * @since 3.0 - */ -public abstract class SubscriberParticipant extends AbstractSynchronizeParticipant implements IPropertyChangeListener { - - private SubscriberSyncInfoCollector collector; - - private SubscriberRefreshSchedule refreshSchedule; - - private int currentMode; - - private IWorkingSet workingSet; - - private ISynchronizeView view; - - private SubscriberParticipantPage page; - - /** - * Key for settings in memento - */ - private static final String CTX_SUBSCRIBER_PARTICIPANT_SETTINGS = TeamUIPlugin.ID + ".TEAMSUBSRCIBERSETTINGS"; //$NON-NLS-1$ - - /** - * Key for schedule in memento - */ - private static final String CTX_SUBSCRIBER_SCHEDULE_SETTINGS = TeamUIPlugin.ID + ".TEAMSUBSRCIBER_REFRESHSCHEDULE"; //$NON-NLS-1$ - - /** - * Property constant indicating the mode of a page has changed. - */ - public static final String P_SYNCVIEWPAGE_WORKINGSET = TeamUIPlugin.ID + ".P_SYNCVIEWPAGE_WORKINGSET"; //$NON-NLS-1$ - - /** - * Property constant indicating the schedule of a page has changed. - */ - public static final String P_SYNCVIEWPAGE_SCHEDULE = TeamUIPlugin.ID + ".P_SYNCVIEWPAGE_SCHEDULE"; //$NON-NLS-1$ - - /** - * Property constant indicating the mode of a page has changed. - */ - public static final String P_SYNCVIEWPAGE_MODE = TeamUIPlugin.ID + ".P_SYNCVIEWPAGE_MODE"; //$NON-NLS-1$ - - /** - * Modes are direction filters for the view - */ - public final static int INCOMING_MODE = 0x1; - public final static int OUTGOING_MODE = 0x2; - public final static int BOTH_MODE = 0x4; - public final static int CONFLICTING_MODE = 0x8; - public final static int ALL_MODES = INCOMING_MODE | OUTGOING_MODE | CONFLICTING_MODE | BOTH_MODE; - - public final static int[] INCOMING_MODE_FILTER = new int[] {SyncInfo.CONFLICTING, SyncInfo.INCOMING}; - public final static int[] OUTGOING_MODE_FILTER = new int[] {SyncInfo.CONFLICTING, SyncInfo.OUTGOING}; - public final static int[] BOTH_MODE_FILTER = new int[] {SyncInfo.CONFLICTING, SyncInfo.INCOMING, SyncInfo.OUTGOING}; - public final static int[] CONFLICTING_MODE_FILTER = new int[] {SyncInfo.CONFLICTING}; - - public SubscriberParticipant() { - super(); - refreshSchedule = new SubscriberRefreshSchedule(this); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.sync.ISynchronizeViewPage#createPage(org.eclipse.team.ui.sync.ISynchronizeView) - */ - public final IPageBookViewPage createPage(ISynchronizeView view) { - this.view = view; - this.page = doCreatePage(view); - return this.page; - } - - protected SubscriberParticipantPage doCreatePage(ISynchronizeView view) { - return new SubscriberParticipantPage(this, view); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#createRefreshPage() - */ - public IWizard createSynchronizeWizard() { - return new SubscriberRefreshWizard(this); - } - - public void setMode(int mode) { - int oldMode = getMode(); - if(oldMode == mode) return; - currentMode = mode; - TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCVIEW_SELECTED_MODE, mode); - updateMode(mode); - firePropertyChange(this, P_SYNCVIEWPAGE_MODE, new Integer(oldMode), new Integer(mode)); - } - - public int getMode() { - return currentMode; - } - - public void setRefreshSchedule(SubscriberRefreshSchedule schedule) { - this.refreshSchedule = schedule; - firePropertyChange(this, P_SYNCVIEWPAGE_SCHEDULE, null, schedule); - } - - public SubscriberRefreshSchedule getRefreshSchedule() { - return refreshSchedule; - } - - public void setWorkingSet(IWorkingSet set) { - IWorkingSet oldSet = workingSet; - if(collector != null) { - IResource[] resources = set != null ? Utils.getResources(set.getElements()) : new IResource[0]; - collector.setWorkingSet(resources); - firePropertyChange(this, P_SYNCVIEWPAGE_WORKINGSET, oldSet, set); - } - workingSet = set; - } - - public IWorkingSet getWorkingSet() { - return workingSet; - } - - public void selectResources(IResource[] resources) { - page.setSelection(resources, true); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#getResources() - */ - public IResource[] getResources() { - return collector.getSubscriber().roots(); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#refresh(org.eclipse.core.resources.IResource[]) - */ - public void refresh(IResource[] resources) { - IWorkbenchSite site = view != null ? view.getSite() : null; - IResource[] resourcesToRefresh = resources; - if((resources == null || resources.length == 0)) { - resourcesToRefresh = collector.getWorkingSet(); - } - RefreshAction.run(site, getName(), resourcesToRefresh, getSubscriberSyncInfoCollector(), new RefreshUserNotificationPolicy(this)); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.sync.AbstractSynchronizeViewPage#dispose() - */ - public void dispose() { - refreshSchedule.dispose(); - TeamUI.removePropertyChangeListener(this); - collector.dispose(); - } - - /** - * Return the <code>SubscriberSyncInfoCollector</code> for the participant. - * This collector maintains the set of all out-of-sync resources for the subscriber. - * @return the <code>SubscriberSyncInfoCollector</code> for this participant - */ - public final SubscriberSyncInfoCollector getSubscriberSyncInfoCollector() { - return collector; - } - - protected void setSubscriber(Subscriber subscriber) { - collector = new SubscriberSyncInfoCollector(subscriber); - - // listen for global ignore changes - TeamUI.addPropertyChangeListener(this); - - preCollectingChanges(); - - collector.start(); - - // start the refresh now that a subscriber has been added - SubscriberRefreshSchedule schedule = getRefreshSchedule(); - if(schedule.isEnabled()) { - getRefreshSchedule().startJob(); - } - } - - /** - * This method is invoked just before the collector is started. - * This gives an oportunity to configure the collector parameters - * before collection starts. The default implementation sets the working - * set as returned by <code>getWorkingSet()</code> and sets the mode - * as returned by <code>getMode()</code>. - */ - protected void preCollectingChanges() { - if(workingSet != null) { - setWorkingSet(workingSet); - } - updateMode(getMode()); - } - - /** - * Get the <code>Subscriber</code> for this participant - * @return a <code>TamSubscriber</code> - */ - public Subscriber getSubscriber() { - return collector.getSubscriber(); - } - - /* (non-Javadoc) - * @see IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent event) { - if (event.getProperty().equals(TeamUI.GLOBAL_IGNORES_CHANGED)) { - collector.reset(); - } - } - - /** - * This method is invoked from <code>setMode</code> when the mode has changed. - * It sets the filter on the collector to show the <code>SyncInfo</code> - * appropriate for the mode. - * @param mode the new mode (one of <code>INCOMING_MODE_FILTER</code>, - * <code>OUTGOING_MODE_FILTER</code>, <code>CONFLICTING_MODE_FILTER</code> - * or <code>BOTH_MODE_FILTER</code>) - */ - protected void updateMode(int mode) { - if(collector != null) { - - int[] modeFilter = BOTH_MODE_FILTER; - switch(mode) { - case SubscriberParticipant.INCOMING_MODE: - modeFilter = INCOMING_MODE_FILTER; break; - case SubscriberParticipant.OUTGOING_MODE: - modeFilter = OUTGOING_MODE_FILTER; break; - case SubscriberParticipant.BOTH_MODE: - modeFilter = BOTH_MODE_FILTER; break; - case SubscriberParticipant.CONFLICTING_MODE: - modeFilter = CONFLICTING_MODE_FILTER; break; - } - - collector.setFilter( - new FastSyncInfoFilter.AndSyncInfoFilter( - new FastSyncInfoFilter[] { - new FastSyncInfoFilter.SyncInfoDirectionFilter(modeFilter) - })); - } - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#init(org.eclipse.ui.IMemento) - */ - public void init(IMemento memento) throws PartInitException { - if(memento != null) { - IMemento settings = memento.getChild(CTX_SUBSCRIBER_PARTICIPANT_SETTINGS); - if(settings != null) { - String setSetting = settings.getString(P_SYNCVIEWPAGE_WORKINGSET); - String modeSetting = settings.getString(P_SYNCVIEWPAGE_MODE); - SubscriberRefreshSchedule schedule = SubscriberRefreshSchedule.init(settings.getChild(CTX_SUBSCRIBER_SCHEDULE_SETTINGS), this); - setRefreshSchedule(schedule); - - if(setSetting != null) { - IWorkingSet workingSet = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(setSetting); - if(workingSet != null) { - setWorkingSet(workingSet); - } - } - - int mode = SubscriberParticipant.BOTH_MODE; - if(modeSetting != null) { - try { - mode = Integer.parseInt(modeSetting); - } catch (NumberFormatException e) { - mode = SubscriberParticipant.BOTH_MODE; - } - } - setMode(mode); - } - } else { - setMode(BOTH_MODE); - } - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#saveState(org.eclipse.ui.IMemento) - */ - public void saveState(IMemento memento) { - IMemento settings = memento.createChild(CTX_SUBSCRIBER_PARTICIPANT_SETTINGS); - IWorkingSet set = getWorkingSet(); - if(set != null) { - settings.putString(P_SYNCVIEWPAGE_WORKINGSET, getWorkingSet().getName()); - } - settings.putString(P_SYNCVIEWPAGE_MODE, Integer.toString(getMode())); - refreshSchedule.saveState(settings.createChild(CTX_SUBSCRIBER_SCHEDULE_SETTINGS)); - } - - public static SubscriberParticipant find(Subscriber s) { - ISynchronizeParticipant[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants(); - for (int i = 0; i < participants.length; i++) { - ISynchronizeParticipant p = participants[i]; - if(p instanceof SubscriberParticipant) { - if(((SubscriberParticipant)p).getSubscriber().equals(s)) { - return (SubscriberParticipant)p; - } - } - } - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipantDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipantDialog.java deleted file mode 100644 index e0f581e07..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipantDialog.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize.subscriber; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.compare.*; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.core.subscribers.Subscriber; -import org.eclipse.team.core.synchronize.SyncInfo; -import org.eclipse.team.internal.ui.*; -import org.eclipse.team.ui.synchronize.viewers.*; - -/** - * Dialog that supports synchronizing a participant and displaying the results in a dialog. The user can edit the changes - * in the dialog and will be prompted to save the changes when the dialog is closed. This provides a modal helper for - * showing a subscriber participant to the user. - * <p> - * Example usage of this dialog: - * <pre> - * SubscriberParticipant = new MyParticipant(); - * SubscriberParticipantDialog dialog = new SubscriberParticipantDialog(shell, participant.getId(), participant, resources); - * dialog.run(); - * </pre> - * </p> - * TODO: mention the remembering of the participant - * - * @see SubscriberParticipant - * @since 3.0 - */ -public class SubscriberParticipantDialog { - - private SubscriberParticipant participant; - private Shell shell; - private IResource[] resources; - private boolean rememberInSyncView; - private String targetId; - - /** - * - * @param shell shell to use to open the compare dialog - * @param participant the participant to use as a basis for the comparison - * @param resources - */ - public SubscriberParticipantDialog(Shell shell, String targetId, SubscriberParticipant participant, IResource[] resources) { - this.shell = shell; - this.targetId = targetId; - this.participant = participant; - this.resources = resources; - } - - public void run() { - Subscriber s = participant.getSubscriber(); - RefreshAction.run(null, participant.getName(), s.roots(), participant.getSubscriberSyncInfoCollector(), new IRefreshSubscriberListener() { - public void refreshStarted(IRefreshEvent event) { - } - public void refreshDone(final IRefreshEvent event) { - TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() { - public void run() { - if (participant.getSubscriberSyncInfoCollector().getSyncInfoTree().isEmpty()) { - MessageDialog.openInformation(getShell(), Policy.bind("OpenComparedDialog.noChangeTitle"), Policy.bind("OpenComparedDialog.noChangesMessage")); //$NON-NLS-1$ //$NON-NLS-2$ - return; - } - if (isSingleFileCompare(resources)) { - compareAndOpenEditors(event, participant); - } else { - compareAndOpenDialog(event, participant); - } - } - }); - } - }); - } - - protected Shell getShell() { - return shell; - } - - protected boolean isSingleFileCompare(IResource[] resources) { - return resources.length == 1 && resources[0].getType() == IResource.FILE; - } - - protected void compareAndOpenEditors(IRefreshEvent event, SubscriberParticipant participant) { - for (int i = 0; i < resources.length; i++) { - SyncInfo info = participant.getSubscriberSyncInfoCollector().getSubscriberSyncInfoSet().getSyncInfo(resources[i]); - if(info != null) { - CompareUI.openCompareEditor(new SyncInfoCompareInput(event.getSubscriber().getName(), info)); - } - } - } - - protected void compareAndOpenDialog(final IRefreshEvent event, final SubscriberParticipant participant) { - TreeViewerAdvisor advisor = new TreeViewerAdvisor(targetId, null, participant.getSubscriberSyncInfoCollector().getSyncInfoTree()); - CompareConfiguration cc = new CompareConfiguration(); - SynchronizeCompareInput input = new SynchronizeCompareInput(cc, advisor) { - public String getTitle() { - int numChanges = participant.getSubscriberSyncInfoCollector().getSyncInfoTree().size(); - if(numChanges > 1) { - return Policy.bind("OpenComparedDialog.diffViewTitleMany", Integer.toString(numChanges)); //$NON-NLS-1$ - } else { - return Policy.bind("OpenComparedDialog.diffViewTitleOne", Integer.toString(numChanges)); //$NON-NLS-1$ - } - } - }; - try { - // model will be built in the background since we know the compare input was - // created with a subscriber participant - input.run(new NullProgressMonitor()); - } catch (InterruptedException e) { - Utils.handle(e); - } catch (InvocationTargetException e) { - Utils.handle(e); - } - SynchronizeDialog dialog = createCompareDialog(getShell(), participant.getName(), input); - if(isRememberInSyncView()) { - dialog.setSynchronizeParticipant(participant); - } - dialog.setBlockOnOpen(true); - dialog.open(); - } - - protected SynchronizeDialog createCompareDialog(Shell shell, String title, CompareEditorInput input) { - return new SynchronizeDialog(shell, title, input); - } - - /** - * @return Returns the rememberInSyncView. - */ - public boolean isRememberInSyncView() { - return rememberInSyncView; - } - /** - * @param rememberInSyncView The rememberInSyncView to set. - */ - public void setRememberInSyncView(boolean rememberInSyncView) { - this.rememberInSyncView = rememberInSyncView; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipantPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipantPage.java deleted file mode 100644 index fe705c96b..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipantPage.java +++ /dev/null @@ -1,319 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize.subscriber; - -import org.eclipse.compare.internal.INavigatable; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jface.action.*; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.jface.viewers.*; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.*; -import org.eclipse.team.internal.ui.*; -import org.eclipse.team.internal.ui.jobs.RefreshUserNotificationPolicy; -import org.eclipse.team.internal.ui.synchronize.ChangesSection; -import org.eclipse.team.internal.ui.synchronize.ConfigureRefreshScheduleDialog; -import org.eclipse.team.internal.ui.synchronize.actions.*; -import org.eclipse.team.ui.synchronize.ISynchronizeView; -import org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor; -import org.eclipse.team.ui.synchronize.viewers.TreeViewerAdvisor; -import org.eclipse.ui.*; -import org.eclipse.ui.part.*; - -/** - * A synchronize view page that works with participants that are subclasses of - * {@link SubscriberParticipant}. It shows changes in the tree or table view - * and supports navigation, opening, and filtering changes. - * <p> - * Clients can subclass to extend the label decoration or add action bar - * contributions. For more extensive modifications, clients should create - * their own custom page. - * </p> - * @since 3.0 - */ -public class SubscriberParticipantPage implements IPageBookViewPage, IPropertyChangeListener, IAdaptable { - // Parent composite of this view. It is remembered so that we can dispose of its children when - // the viewer type is switched. - private Composite composite = null; - private ChangesSection changesSection; - private Viewer changesViewer; - private boolean settingWorkingSet = false; - - private ISynchronizeView view; - private SubscriberParticipant participant; - private IPageSite site; - - // Toolbar and status line actions for this page, note that context menu actions shown in - // the changes viewer are contributed via the viewer and not the page. - private NavigateAction gotoNext; - private NavigateAction gotoPrevious; - private Action configureSchedule; - private SyncViewerShowPreferencesAction showPreferences; - private RefreshAction refreshAllAction; - private Action collapseAll; - private WorkingSetFilterActionGroup workingSetGroup; - private StatusLineContributionGroup statusLine; - private SynchronizeViewerAdvisor viewerAdvisor; - - /** - * Constructs a new SynchronizeView. - */ - public SubscriberParticipantPage(SubscriberParticipant page, ISynchronizeView view) { - this.participant = page; - this.view = view; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent) { - composite = new Composite(parent, SWT.NONE); - //sc.setContent(composite); - GridLayout gridLayout= new GridLayout(); - gridLayout.makeColumnsEqualWidth= false; - gridLayout.marginWidth= 0; - gridLayout.marginHeight = 0; - gridLayout.verticalSpacing = 0; - composite.setLayout(gridLayout); - GridData data = new GridData(GridData.FILL_BOTH); - data.grabExcessVerticalSpace = true; - composite.setLayoutData(data); - - // Create the changes section which, in turn, creates the changes viewer and its configuration - this.changesSection = new ChangesSection(composite, this); - this.changesViewer = createChangesViewer(changesSection.getComposite()); - changesSection.setViewer(changesViewer); - - // toolbar - INavigatable nav = new INavigatable() { - public boolean gotoDifference(boolean next) { - return viewerAdvisor.navigate(next); - } - }; - gotoNext = new NavigateAction(view, nav, true /*next*/); - gotoPrevious = new NavigateAction(view, nav, false /*previous*/); - refreshAllAction = new RefreshAction(getSite().getSelectionProvider(), getParticipant().getName(), getParticipant().getSubscriberSyncInfoCollector(), new RefreshUserNotificationPolicy(getParticipant()), true /* refresh all */); - refreshAllAction.setWorkbenchSite(view.getSite()); - collapseAll = new Action() { - public void run() { - if (changesViewer == null || !(changesViewer instanceof AbstractTreeViewer)) return; - changesViewer.getControl().setRedraw(false); - ((AbstractTreeViewer)changesViewer).collapseToLevel(changesViewer.getInput(), TreeViewer.ALL_LEVELS); - changesViewer.getControl().setRedraw(true); - } - }; - Utils.initAction(collapseAll, "action.collapseAll."); //$NON-NLS-1$ - - configureSchedule = new Action() { - public void run() { - ConfigureRefreshScheduleDialog d = new ConfigureRefreshScheduleDialog( - getShell(), participant.getRefreshSchedule()); - d.setBlockOnOpen(false); - d.open(); - } - }; - Utils.initAction(configureSchedule, "action.configureSchedulel."); //$NON-NLS-1$ - - // view menu - workingSetGroup = new WorkingSetFilterActionGroup(getShell(), this, view, participant); - showPreferences = new SyncViewerShowPreferencesAction(getShell()); - statusLine = new StatusLineContributionGroup(getShell(), getParticipant(), workingSetGroup); - - participant.addPropertyChangeListener(this); - TeamUIPlugin.getPlugin().getPreferenceStore().addPropertyChangeListener(this); - participant.setMode(participant.getMode()); - } - - private Shell getShell() { - return view.getSite().getShell(); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IViewPart#init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento) - */ - public void init(IPageSite site) throws PartInitException { - this.site = site; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.IPage#setFocus() - */ - public void setFocus() { - changesSection.setFocus(); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#dispose() - */ - public void dispose() { - statusLine.dispose(); - changesSection.dispose(); - viewerAdvisor.dispose(); - TeamUIPlugin.getPlugin().getPreferenceStore().removePropertyChangeListener(this); - participant.removePropertyChangeListener(this); - } - - /* - * This method enables "Show In" support for this view - * - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - public Object getAdapter(Class key) { - if (key.equals(ISelectionProvider.class)) - return changesViewer; - if (key == IShowInSource.class) { - return new IShowInSource() { - public ShowInContext getShowInContext() { - StructuredViewer v = (StructuredViewer)changesViewer; - if (v == null) return null; - ISelection s = v.getSelection(); - if (s instanceof IStructuredSelection) { - Object[] resources = Utils.getResources(((IStructuredSelection)s).toArray()); - return new ShowInContext(null, new StructuredSelection(resources)); - } - return null; - } - }; - } - if (key == IShowInTargetList.class) { - return new IShowInTargetList() { - public String[] getShowInTargetIds() { - return new String[] { IPageLayout.ID_RES_NAV }; - } - - }; - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.IPage#getControl() - */ - public Control getControl() { - return composite; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.IPage#setActionBars(org.eclipse.ui.IActionBars) - */ - public void setActionBars(IActionBars actionBars) { - if(actionBars != null) { - IToolBarManager manager = actionBars.getToolBarManager(); - - // toolbar - manager.add(refreshAllAction); - manager.add(new Separator()); - if(gotoNext != null) { - manager.add(gotoNext); - manager.add(gotoPrevious); - } - manager.add(collapseAll); - manager.add(new Separator()); - - // view menu - IMenuManager menu = actionBars.getMenuManager(); - MenuManager layoutMenu = new MenuManager(Policy.bind("action.layout.label")); //$NON-NLS-1$ - MenuManager comparisonCriteria = new MenuManager(Policy.bind("action.comparisonCriteria.label")); //$NON-NLS-1$ - //comparisonCriteriaGroup.addActionsToMenuMgr(comparisonCriteria); - workingSetGroup.fillActionBars(actionBars); - menu.add(new Separator()); - menu.add(new Separator()); - menu.add(new Separator("others")); //$NON-NLS-1$ - menu.add(new Separator()); - menu.add(configureSchedule); - menu.add(new Separator()); - menu.add(showPreferences); - - // status line - statusLine.fillActionBars(actionBars); - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.IPageBookViewPage#getSite() - */ - public IPageSite getSite() { - return this.site; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent event) { - // Working set changed by user - if(event.getProperty().equals(WorkingSetFilterActionGroup.CHANGE_WORKING_SET)) { - if(settingWorkingSet) return; - settingWorkingSet = true; - participant.setWorkingSet((IWorkingSet)event.getNewValue()); - settingWorkingSet = false; - // Working set changed programatically - } else if(event.getProperty().equals(SubscriberParticipant.P_SYNCVIEWPAGE_WORKINGSET)) { - if(settingWorkingSet) return; - settingWorkingSet = true; - Object newValue = event.getNewValue(); - if (newValue instanceof IWorkingSet) { - workingSetGroup.setWorkingSet((IWorkingSet)newValue); - } else if (newValue == null) { - workingSetGroup.setWorkingSet(null); - } - settingWorkingSet = false; - // Change to showing of sync state in text labels preference - } else if(event.getProperty().equals(IPreferenceIds.SYNCVIEW_VIEW_SYNCINFO_IN_LABEL)) { - if(changesViewer instanceof StructuredViewer) { - ((StructuredViewer)changesViewer).refresh(true /* update labels */); - } - } - } - - /** - * @return Returns the participant. - */ - public SubscriberParticipant getParticipant() { - return participant; - } - - /** - * @return Returns the view. - */ - public ISynchronizeView getSynchronizeView() { - return view; - } - - private Viewer createChangesViewer(Composite parent) { - viewerAdvisor = createSynchronizeViewerAdvisor(); - TreeViewer viewer = new TreeViewerAdvisor.NavigableTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - GridData data = new GridData(GridData.FILL_BOTH); - viewer.getControl().setLayoutData(data); - viewerAdvisor.initializeViewer(viewer); - getSite().setSelectionProvider(viewer); - return viewer; - } - - public StructuredViewerAdvisor getViewerConfiguration() { - return viewerAdvisor; - } - - public Viewer getViewer() { - return changesViewer; - } - - protected SynchronizeViewerAdvisor createSynchronizeViewerAdvisor() { - return new SynchronizeViewerAdvisor(getSynchronizeView(), getParticipant()); - } - - public void setSelection(IResource[] resources, boolean reveal) { - getViewerConfiguration().setSelection(resources, reveal); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberRefreshSchedule.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberRefreshSchedule.java deleted file mode 100644 index 17acfd648..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberRefreshSchedule.java +++ /dev/null @@ -1,193 +0,0 @@ -package org.eclipse.team.ui.synchronize.subscriber; - -import java.text.DateFormat; -import java.util.Date; - -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.team.core.synchronize.SyncInfo; -import org.eclipse.team.core.synchronize.SyncInfoSet; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.jobs.RefreshSubscriberJob; -import org.eclipse.ui.IMemento; - -public class SubscriberRefreshSchedule { - private long refreshInterval = 3600; // 1 hour default - - private boolean enabled = false; - - private RefreshSubscriberJob job; - - private SubscriberParticipant participant; - - private IRefreshEvent lastRefreshEvent; - - /** - * Key for settings in memento - */ - private static final String CTX_REFRESHSCHEDULE_INTERVAL = TeamUIPlugin.ID + ".CTX_REFRESHSCHEDULE_INTERVAL"; //$NON-NLS-1$ - - /** - * Key for schedule in memento - */ - private static final String CTX_REFRESHSCHEDULE_ENABLED = TeamUIPlugin.ID + ".CTX_REFRESHSCHEDULE_ENABLED"; //$NON-NLS-1$ - - private IRefreshSubscriberListener refreshSubscriberListener = new IRefreshSubscriberListener() { - public void refreshStarted(IRefreshEvent event) { - } - public void refreshDone(final IRefreshEvent event) { - if (event.getSubscriber() == participant.getSubscriber()) { - lastRefreshEvent = event; - } - } - }; - - - public SubscriberRefreshSchedule(SubscriberParticipant participant) { - this.participant = participant; - RefreshSubscriberJob.addRefreshListener(refreshSubscriberListener); - } - - /** - * @return Returns the enabled. - */ - public boolean isEnabled() { - return enabled; - } - - /** - * @param enabled The enabled to set. - */ - public void setEnabled(boolean enabled, boolean allowedToStart) { - boolean wasEnabled = isEnabled(); - this.enabled = enabled; - if(enabled && ! wasEnabled) { - if(allowedToStart) { - startJob(); - } - } else { - stopJob(); - } - } - - /** - * @return Returns the refreshInterval. - */ - public long getRefreshInterval() { - return refreshInterval; - } - - public SubscriberParticipant getParticipant() { - return participant; - } - - /** - * @param refreshInterval The refreshInterval to set. - */ - public void setRefreshInterval(long refreshInterval) { - stopJob(); - this.refreshInterval = refreshInterval; - if(isEnabled()) { - startJob(); - } - } - - protected void startJob() { - SyncInfoSet set = participant.getSubscriberSyncInfoCollector().getSyncInfoTree(); - if(set == null) { - return; - } - if(job == null) { - job = new RefreshSubscriberJob(Policy.bind("RefreshSchedule.14", participant.getName(), getRefreshIntervalAsString()), participant.getSubscriberSyncInfoCollector()); //$NON-NLS-1$ - } else if(job.getState() != Job.NONE){ - stopJob(); - } - job.setRestartOnCancel(true); - job.setReschedule(true); - job.schedule(getRefreshInterval()); - } - - protected void stopJob() { - if(job != null) { - job.setRestartOnCancel(false /* don't restart the job */); - job.setReschedule(false); - job.cancel(); - job = null; - } - } - - public void dispose() { - stopJob(); - RefreshSubscriberJob.removeRefreshListener(refreshSubscriberListener); - } - - public void saveState(IMemento memento) { - memento.putString(CTX_REFRESHSCHEDULE_ENABLED, Boolean.toString(enabled)); - memento.putInteger(CTX_REFRESHSCHEDULE_INTERVAL, (int)refreshInterval); - } - - public static SubscriberRefreshSchedule init(IMemento memento, SubscriberParticipant participant) { - SubscriberRefreshSchedule schedule = new SubscriberRefreshSchedule(participant); - if(memento != null) { - String enabled = memento.getString(CTX_REFRESHSCHEDULE_ENABLED); - int interval = memento.getInteger(CTX_REFRESHSCHEDULE_INTERVAL).intValue(); - schedule.setRefreshInterval(interval); - schedule.setEnabled("true".equals(enabled) ? true : false, false /* don't start job */); //$NON-NLS-1$ - } - // Use the defaults if a schedule hasn't been saved or can't be found. - return schedule; - } - - public static String refreshEventAsString(IRefreshEvent event) { - if(event == null) { - return Policy.bind("SyncViewPreferencePage.lastRefreshRunNever"); //$NON-NLS-1$ - } - long stopMills = event.getStopTime(); - long startMills = event.getStartTime(); - StringBuffer text = new StringBuffer(); - if(stopMills <= 0) { - text.append(Policy.bind("SyncViewPreferencePage.lastRefreshRunNever")); //$NON-NLS-1$ - } else { - Date lastTimeRun = new Date(stopMills); - text.append(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(lastTimeRun)); - } - SyncInfo[] changes = event.getChanges(); - if (changes.length != 0) { - text.append(Policy.bind("RefreshSchedule.6", Integer.toString(changes.length))); //$NON-NLS-1$ - } else { - text.append(Policy.bind("RefreshSchedule.7")); //$NON-NLS-1$ - } - return text.toString(); - } - - public String getScheduleAsString() { - if(! isEnabled()) { - return Policy.bind("RefreshSchedule.8"); //$NON-NLS-1$ - } - return getRefreshIntervalAsString(); - } - - public IRefreshEvent getLastRefreshEvent() { - return lastRefreshEvent; - } - - private String getRefreshIntervalAsString() { - boolean hours = false; - long seconds = getRefreshInterval(); - if(seconds <= 60) { - seconds = 60; - } - long minutes = seconds / 60; - if(minutes >= 60) { - minutes = minutes / 60; - hours = true; - } - String unit; - if(minutes >= 1) { - unit = (hours ? Policy.bind("RefreshSchedule.9") : Policy.bind("RefreshSchedule.10")); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - unit = (hours ? Policy.bind("RefreshSchedule.11") : Policy.bind("RefreshSchedule.12")); //$NON-NLS-1$ //$NON-NLS-2$ - } - return Policy.bind("RefreshSchedule.13", Long.toString(minutes), unit); //$NON-NLS-1$ - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SynchronizeViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SynchronizeViewerAdvisor.java deleted file mode 100644 index b3b00ce68..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SynchronizeViewerAdvisor.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize.subscriber; - -import org.eclipse.compare.structuremergeviewer.DiffNode; -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.viewers.*; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.jobs.RefreshUserNotificationPolicy; -import org.eclipse.team.internal.ui.synchronize.actions.OpenWithActionGroup; -import org.eclipse.team.internal.ui.synchronize.actions.RefactorActionGroup; -import org.eclipse.team.ui.synchronize.ISynchronizeView; -import org.eclipse.team.ui.synchronize.viewers.SyncInfoModelElement; -import org.eclipse.team.ui.synchronize.viewers.TreeViewerAdvisor; - -/** - * Overrides the SyncInfoDiffViewerConfiguration to configure the diff viewer - * for the synchroniza view - */ -public class SynchronizeViewerAdvisor extends TreeViewerAdvisor { - - private ISynchronizeView view; - private SubscriberParticipant participant; - private OpenWithActionGroup openWithActions; - private RefactorActionGroup refactorActions; - private RefreshAction refreshSelectionAction; - - public SynchronizeViewerAdvisor(ISynchronizeView view, SubscriberParticipant participant) { - super(participant.getId(), view.getViewSite(), participant.getSubscriberSyncInfoCollector().getSyncInfoTree()); - this.view = view; - this.participant = participant; - } - - protected SubscriberParticipant getParticipant() { - return participant; - } - - protected void initializeActions(StructuredViewer treeViewer) { - super.initializeActions(treeViewer); - openWithActions = new OpenWithActionGroup(view, participant); - refactorActions = new RefactorActionGroup(view); - refreshSelectionAction = new RefreshAction(view.getSite().getSelectionProvider(), getParticipant().getName(), getParticipant().getSubscriberSyncInfoCollector(), new RefreshUserNotificationPolicy(getParticipant()), true /* refresh all */); - refreshSelectionAction.setWorkbenchSite(view.getSite()); - } - - protected void fillContextMenu(StructuredViewer viewer, IMenuManager manager) { - openWithActions.fillContextMenu(manager); - refactorActions.fillContextMenu(manager); - manager.add(refreshSelectionAction); - manager.add(new Separator()); - super.fillContextMenu(viewer, manager); - } - - /* - * (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.SyncInfoDiffTreeViewer#handleDoubleClick(org.eclipse.jface.viewers.DoubleClickEvent) - */ - protected void handleDoubleClick(StructuredViewer viewer, DoubleClickEvent event) { - IStructuredSelection selection = (IStructuredSelection) event.getSelection(); - DiffNode node = (DiffNode) selection.getFirstElement(); - if (node != null && node instanceof SyncInfoModelElement) { - SyncInfoModelElement syncNode = (SyncInfoModelElement) node; - IResource resource = syncNode.getResource(); - if (syncNode != null && resource != null && resource.getType() == IResource.FILE) { - openWithActions.openInCompareEditor(); - return; - } - } - // Double-clicking should expand/collapse containers - super.handleDoubleClick(viewer, event); - } - - protected void initializeListeners(StructuredViewer viewer) { - viewer.addSelectionChangedListener(new ISelectionChangedListener() { - - public void selectionChanged(SelectionChangedEvent event) { - updateStatusLine((IStructuredSelection) event.getSelection()); - } - }); - viewer.addOpenListener(new IOpenListener() { - - public void open(OpenEvent event) { - handleOpen(); - } - }); - super.initializeListeners(viewer); - } - - protected void handleOpen() { - openWithActions.openInCompareEditor(); - } - - /** - * Updates the message shown in the status line. - * @param selection - * the current selection - */ - private void updateStatusLine(IStructuredSelection selection) { - String msg = getStatusLineMessage(selection); - view.getViewSite().getActionBars().getStatusLineManager().setMessage(msg); - } - - /** - * Returns the message to show in the status line. - * @param selection - * the current selection - * @return the status line message - * @since 2.0 - */ - private String getStatusLineMessage(IStructuredSelection selection) { - if (selection.size() == 1) { - Object first = selection.getFirstElement(); - if (first instanceof SyncInfoModelElement) { - SyncInfoModelElement node = (SyncInfoModelElement) first; - IResource resource = node.getResource(); - if (resource == null) { - return node.getName(); - } else { - return resource.getFullPath().makeRelative().toString(); - } - } - } - if (selection.size() > 1) { - return selection.size() + Policy.bind("SynchronizeView.13"); //$NON-NLS-1$ - } - return ""; //$NON-NLS-1$ - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/package.html b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/package.html deleted file mode 100644 index 729b92e03..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/package.html +++ /dev/null @@ -1,43 +0,0 @@ -<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en"> -<html> -<head> - <meta content="text/html; charset=iso-8859-1" - http-equiv="Content-Type"> - <meta content="IBM" name="Author"> - <title>Package-level Javadoc</title> -</head> -<body> -<p>Actions and utilities for use with the Eclipse Synchronize View.</p> -<h2>Package Specification</h2> -<p>This package contains actions that are used by subclasses of <b>TeamSubscriberParticipant</b>. -<br> -</p> -<p>The class <b>TeamSubscriberParticipant</b> provides an -implementation of a synchronize participant that enables -synchronization for a <b>Subscriber</b>. For providers that implement -a <strong>Subscriber</strong>, this is the easiest method of -integrating into the Synchronize View. The TeamSubscriberParticipant -provides a view of changes (incoming, outgoing, conflicting), modes for -showing only a subset of the changes, decorations for identifying the -changes, and working sets. Here are the steps for creating a -participant based on the TeamSubscriberParticipant implementation:</p> -<ul> - <li>Implement a concrete subclass of <strong>TeamSubscriber</strong> -that will provide the physical connection between the workspace -resources and the remote location that is used to share the resources.</li> - <li>Subclass <strong>TeamSubscriberParticipant</strong> and provide -concrete implementations for init(QualifiedName), saveState(), and -optionally createPage().</li> - <li>To add actions to the context menu of the participant page you -must create a viewerContribution in your plugin.xml with the targetID -field equal to that of the qualifier part of the participant's type id. -For example: - <pre><viewerContribution id="org.eclipse.myteamplugin.syncparticipant.actions" <br> targetID="org.eclipse.myteamplugin.syncparticipant"</pre> - </li> - <li>To add participant specific actions to the view's action bar, -subclass TeamSubscriberParticipantPage and implement setActionBars().</li> - <li>To add participant specific decorations to the viewer, subclass -TeamSubscriberParticipantPage and implement getLabelProvider().</li> -</ul> -</body> -</html> diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/ISynchronizeModelChangeListener.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/ISynchronizeModelChangeListener.java deleted file mode 100644 index 189aa111f..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/ISynchronizeModelChangeListener.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize.viewers; - -/** - * Listener that gets informed when the model created by the model provider is created or updated. - * <p> - * Clients may implement this interface. - * </p> - * @since 3.0 - */ -public interface ISynchronizeModelChangeListener { - /** - * Called whenever the input model shown in a diff node viewer is updated. - * - * @param input the root <code>DiffNode</code> of the model. - */ - public void modelChanged(SynchronizeModelElement root); -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/ISynchronizeModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/ISynchronizeModelProvider.java deleted file mode 100644 index 63a204a80..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/ISynchronizeModelProvider.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize.viewers; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.team.core.synchronize.SyncInfoSet; - -/** - * This class represents provisional API. A provider is not required to - * implement this API. Implementers, and those who reference it, do so with the - * awareness that this class may be removed or substantially changed at future - * times without warning. - */ -public interface ISynchronizeModelProvider { - - public abstract SyncInfoSet getSyncInfoSet(); - - /** - * Return the <code>AbstractTreeViewer</code> asociated with this content - * provider or <code>null</code> if the viewer is not of the proper type. - * @return - */ - public abstract StructuredViewer getViewer(); - - public abstract void setViewer(StructuredViewer viewer); - - /** - * Builds the viewer model based on the contents of the sync set. - */ - public abstract SynchronizeModelElement prepareInput(IProgressMonitor monitor); - - /** - * The provider can try and return a mapping for the provided object. Providers often use mappings - * to store the source of a logical element they have created. For example, when displaying resource - * based logical elements, a provider will cache the resource -> element mapping for quick retrieval - * of the element when resource based changes are made. - * - * @param object the object to query for a mapping - * @return an object created by this provider that would be shown in a viewer, or <code>null</code> - * if the provided object is not mapped by this provider. - */ - public abstract Object getMapping(Object object); - - /** - * Dispose of the builder - */ - public abstract void dispose(); - - /** - * Returns the input created by this controller or <code>null</code> if - * {@link #prepareInput(IProgressMonitor)} hasn't been called on this object yet. - * @return - */ - public abstract SynchronizeModelElement getModelRoot(); - - public abstract ViewerSorter getViewerSorter(); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/StructuredViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/StructuredViewerAdvisor.java deleted file mode 100644 index c827836ac..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/StructuredViewerAdvisor.java +++ /dev/null @@ -1,437 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize.viewers; - -import org.eclipse.compare.structuremergeviewer.*; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.action.*; -import org.eclipse.jface.util.ListenerList; -import org.eclipse.jface.viewers.*; -import org.eclipse.swt.events.MenuEvent; -import org.eclipse.swt.events.MenuListener; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.synchronize.SyncInfoSet; -import org.eclipse.team.internal.core.Assert; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.team.internal.ui.synchronize.SynchronizeModelProvider; -import org.eclipse.ui.IWorkbenchPartSite; -import org.eclipse.ui.internal.PluginAction; -import org.eclipse.ui.model.BaseWorkbenchContentProvider; - -/** - * A <code>StructuredViewerAdvisor</code> controls various UI - * aspects of viewers that show {@link SyncInfoSet} like the context menu, toolbar, - * content provider, label provider, navigation, and model provider. The - * advisor allows decoupling viewer behavior from the viewers presentation. This - * allows viewers that aren't in the same class hierarchy to re-use basic - * behavior. - * <p> - * This advisor allows viewer contributions made in a plug-in manifest to - * be scoped to a particular unique id. As a result the context menu for the - * viewer can be configured to show object contributions for random id schemes. - * To enable declarative action contributions for a configuration there are two - * steps required: - * <ul> - * <li>Create a viewer contribution with a <code>targetID</code> that groups - * sets of actions that are related. A common pratice for synchronize view - * configurations is to use the participant id as the targetID. - * - * <pre> - * <viewerContribution - * id="org.eclipse.team.ccvs.ui.CVSCompareSubscriberContributions" - * targetID="org.eclipse.team.cvs.ui.compare-participant"> - * ... - * </pre> - * - * <li>Create a configuration instance with a <code>menuID</code> that - * matches the targetID in the viewer contribution. - * </ul> - * </p><p> - * Clients may subclass to add behavior for concrete structured viewers. - * </p> - * - * @see TreeViewerAdvisor - * @since 3.0 - */ -public abstract class StructuredViewerAdvisor { - - // Workbench site is used to register the context menu for the viewer - private IWorkbenchPartSite site; - // The id to use for registration of the context menu. If null then menu will not allow viewer contributions. - private String targetID; - - // The physical model shown to the user in the provided viewer. The information in - // this set is transformed by the model provider into the actual logical model displayed - // in the viewer. - private SyncInfoSet set; - private StructuredViewer viewer; - private SynchronizeModelProvider modelProvider; - - // Listeners for model changes - private ListenerList listeners; - - /** - * Create an advisor that will allow viewer contributions with the given <code>targetID</code>. This - * advisor will provide a presentation model based on the given sync info set. Note that it's important - * to call {@link #dispose()} when finished with an advisor. - * - * @param targetID the targetID defined in the viewer contributions in a plugin.xml file. - * @param site the workbench site with which to register the menuId. Can be <code>null</code> in which - * case a site will be found using the default workbench page. - * @param set the set of <code>SyncInfo</code> objects that are to be shown to the user. - */ - public StructuredViewerAdvisor(String targetID, IWorkbenchPartSite site, SyncInfoSet set) { - this.set = set; - this.targetID = targetID; - this.site = site; - } - - /** - * Create an advisor that will provide a presentation model based on the given sync info set. - * Note that it's important to call {@link #dispose()} when finished with an advisor. - * - * @param set the set of <code>SyncInfo</code> objects that are to be shown to the user. - */ - public StructuredViewerAdvisor(SyncInfoSet set) { - this(null, null, set); - } - - /** - * Install a viewer to be configured with this advisor. An advisor can only be installed with - * one viewer at a time. When this method completes the viewer is considered initialized and - * can be shown to the user. - - * @param viewer the viewer being installed - */ - public final void initializeViewer(StructuredViewer viewer) { - Assert.isTrue(this.viewer == null, "Can only be initialized once."); //$NON-NLS-1$ - Assert.isTrue(validateViewer(viewer)); - this.viewer = viewer; - - initializeListeners(viewer); - hookContextMenu(viewer); - initializeActions(viewer); - viewer.setLabelProvider(getLabelProvider()); - viewer.setContentProvider(getContentProvider()); - - // The input may of been set already. In that case, don't change it and - // simply assign it to the view. - if(modelProvider == null) { - modelProvider = getModelProvider(); - modelProvider.prepareInput(null); - } - setInput(viewer); - } - - /** - * This is called to add a listener to the model shown in the viewer. The listener is - * called when the model is changed or updated. - * - * @param listener the listener to add - */ - public void addInputChangedListener(ISynchronizeModelChangeListener listener) { - if (listeners == null) - listeners= new ListenerList(); - listeners.add(listener); - } - - /** - * Remove a model listener. - * - * @param listener the listener to remove. - */ - public void removeInputChangedListener(ISynchronizeModelChangeListener listener) { - if (listeners != null) { - listeners.remove(listener); - if (listeners.isEmpty()) - listeners= null; - } - } - - /** - * Must be called when an advisor is no longer needed. - */ - public void dispose() { - if(modelProvider != null) { - modelProvider.dispose(); - } - } - - /** - * Return the targetID that is used to obtain context menu items from the workbench. When - * a context menu is added to the viewer, this ID is registered with the workbench to allow - * viewer contributions. - * - * @return the targetID or <code>null</code> if this advisor doesn't allow contributions. - */ - public String getTargetID() { - return targetID; - } - - /** - * Return the <code>SyncInfoSet</code> used to create the model shown by this advisor. - * - * @return the <code>SyncInfoSet</code> used to create the model shown by this advisor. - */ - public SyncInfoSet getSyncInfoSet() { - return set; - } - - /** - * Subclasses must implement to allow navigation of their viewers. - * - * @param next if <code>true</code> then navigate forwards, otherwise navigate - * backwards. - * @return <code>true</code> if the end is reached, and <code>false</code> otherwise. - */ - public abstract boolean navigate(boolean next); - - /** - * Sets a new selection for this viewer and optionally makes it visible. The advisor will try and - * convert the objects into the appropriate viewer objects. This is required because the model - * provider controls the actual model elements in the viewer and must be consulted in order to - * understand what objects can be selected in the viewer. - * - * @param object the objects to select - * @param reveal <code>true</code> if the selection is to be made visible, and - * <code>false</code> otherwise - */ - public void setSelection(Object[] objects, boolean reveal) { - Object[] viewerObjects = new Object[objects.length]; - if (modelProvider != null) { - for (int i = 0; i < objects.length; i++) { - viewerObjects[i] = modelProvider.getMapping(objects[i]); - } - viewer.setSelection(new StructuredSelection(viewerObjects), reveal); - } - } - - /** - * Creates the model that will be shown in the viewers. This can be called before the - * viewer has been created. - * <p> - * The result of this method can be shown used as the input to a viewer. However, the - * prefered method of initializing a viewer is to call {@link #initializeViewer(StructuredViewer)} - * directly. This method only exists when the model must be created before the - * viewer. - * </p> - * @param monitor shows progress while preparing the model - * @return the model that can be shown in a viewer - */ - public Object prepareInput(IProgressMonitor monitor) throws TeamException { - if(modelProvider != null) { - modelProvider.dispose(); - } - modelProvider = getModelProvider(); - return modelProvider.prepareInput(monitor); - } - - /** - * Callback that is invoked when a context menu is about to be shown in the - * viewer. Subsclasses must implement to contribute menus. Also, menus can - * contributed by creating a viewer contribution with a <code>targetID</code> - * that groups sets of actions that are related. - * - * @param viewer the viewer in which the context menu is being shown. - * @param manager the menu manager to which actions can be added. - */ - protected void fillContextMenu(final StructuredViewer viewer, IMenuManager manager) { - } - - /** - * Method invoked from <code>initializeViewer(Composite, StructuredViewer)</code> - * in order to initialize any actions for the viewer. It is invoked before - * the input is set on the viewer in order to allow actions to be - * initialized before there is any reaction to the input being set (e.g. - * selecting and opening the first element). - * <p> - * The default behavior is to add the up and down navigation nuttons to the - * toolbar. Subclasses can override. - * </p> - * @param viewer the viewer being initialize - */ - protected void initializeActions(StructuredViewer viewer) { - } - - /** - * Method invoked from <code>initializeViewer(Composite, StructuredViewer)</code> - * in order to initialize any listeners for the viewer. - * - * @param viewer the viewer being initialize - */ - protected void initializeListeners(final StructuredViewer viewer) { - } - - /** - * Get the input that will be assigned to the viewer initialized by this - * configuration. Subclass may override. - * @return the viewer input - */ - protected abstract SynchronizeModelProvider getModelProvider(); - - - /** - * Subclasses can validate that the viewer being initialized with this advisor - * is of the correct type. - * - * @param viewer the viewer to validate - * @return <code>true</code> if the viewer is valid, <code>false</code> otherwise. - */ - protected abstract boolean validateViewer(StructuredViewer viewer); - - /** - * Returns whether workbench menu items whould be included in the context - * menu. By default, this returns <code>true</code> if there is a menu id - * and <code>false</code> otherwise - * @return whether to include workbench context menu items - */ - protected boolean allowParticipantMenuContributions() { - return getTargetID() != null; - } - - /** - * Run the runnable in the UI thread. - * @param r the runnable to run in the UI thread. - */ - protected void aSyncExec(Runnable r) { - final Control ctrl = viewer.getControl(); - if (ctrl != null && !ctrl.isDisposed()) { - ctrl.getDisplay().asyncExec(r); - } - } - - private void fireChanges() { - if (listeners != null) { - Object[] l= listeners.getListeners(); - for (int i= 0; i < l.length; i++) - ((ISynchronizeModelChangeListener) l[i]).modelChanged(modelProvider.getModelRoot()); - } - } - - /** - * Returns the content provider for the viewer. - * - * @return the content provider for the viewer. - */ - protected IStructuredContentProvider getContentProvider() { - return new BaseWorkbenchContentProvider(); - } - - - /** - * Get the label provider that will be assigned to the viewer initialized - * by this configuration. Subclass may override but should either wrap the - * default one provided by this method or subclass <code>TeamSubscriberParticipantLabelProvider</code>. - * In the later case, the logical label provider should still be assigned - * to the subclass of <code>TeamSubscriberParticipantLabelProvider</code>. - * @param logicalProvider - * the label provider for the selected logical view - * @return a label provider - * @see SynchronizeModelElementLabelProvider - */ - protected ILabelProvider getLabelProvider() { - return new SynchronizeModelElementLabelProvider(); - } - - /** - * Returns the viewer configured by this advisor. - * - * @return the viewer configured by this advisor. - */ - protected StructuredViewer getViewer() { - return viewer; - } - - /** - * Method invoked from <code>initializeViewer(StructuredViewer)</code> - * in order to configure the viewer to call <code>fillContextMenu(StructuredViewer, IMenuManager)</code> - * when a context menu is being displayed in viewer. - * - * @param viewer the viewer being initialized - * @see fillContextMenu(StructuredViewer, IMenuManager) - */ - protected final void hookContextMenu(final StructuredViewer viewer) { - final MenuManager menuMgr = new MenuManager(getTargetID()); //$NON-NLS-1$ - menuMgr.setRemoveAllWhenShown(true); - menuMgr.addMenuListener(new IMenuListener() { - - public void menuAboutToShow(IMenuManager manager) { - fillContextMenu(viewer, manager); - } - }); - Menu menu = menuMgr.createContextMenu(viewer.getControl()); - menu.addMenuListener(new MenuListener() { - - public void menuHidden(MenuEvent e) { - } - - // Hack to allow action contributions to update their - // state before the menu is shown. This is required when - // the state of the selection changes and the contributions - // need to update enablement based on this. - public void menuShown(MenuEvent e) { - IContributionItem[] items = menuMgr.getItems(); - for (int i = 0; i < items.length; i++) { - IContributionItem item = items[i]; - if (item instanceof ActionContributionItem) { - IAction actionItem = ((ActionContributionItem) item).getAction(); - if (actionItem instanceof PluginAction) { - ((PluginAction) actionItem).selectionChanged(viewer.getSelection()); - } - } - } - } - }); - viewer.getControl().setMenu(menu); - if (allowParticipantMenuContributions()) { - IWorkbenchPartSite ws = getWorkbenchPartSite(); - if(ws == null) - Utils.findSite(viewer.getControl()); - if (ws == null) - ws = Utils.findSite(); - if (ws != null) { - ws.registerContextMenu(getTargetID(), menuMgr, viewer); - } else { - TeamUIPlugin.log(IStatus.ERROR, "Cannot add menu contributions because the site cannot be found: " + getTargetID(), null); //$NON-NLS-1$ - } - } - } - - /** - * Called to set the input to a viewer. The input to a viewer is always the model created - * by the model provider. - * - * @param viewer the viewer to set the input. - */ - protected final void setInput(StructuredViewer viewer) { - modelProvider.setViewer(viewer); - viewer.setSorter(modelProvider.getViewerSorter()); - DiffNode input = modelProvider.getModelRoot(); - input.addCompareInputChangeListener(new ICompareInputChangeListener() { - public void compareInputChanged(ICompareInput source) { - fireChanges(); - } - }); - viewer.setInput(modelProvider.getModelRoot()); - } - - /** - * Returns the part site in which to register the context menu viewer contributions for this - * advisor. - */ - protected IWorkbenchPartSite getWorkbenchPartSite() { - return this.site; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SyncInfoCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SyncInfoCompareInput.java deleted file mode 100644 index e3c9c9f29..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SyncInfoCompareInput.java +++ /dev/null @@ -1,260 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize.viewers; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.compare.*; -import org.eclipse.compare.structuremergeviewer.DiffNode; -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.*; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.swt.graphics.Image; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.synchronize.SyncInfo; -import org.eclipse.team.internal.core.Assert; -import org.eclipse.team.internal.ui.*; -import org.eclipse.team.internal.ui.synchronize.LocalResourceTypedElement; -import org.eclipse.team.ui.ISharedImages; -import org.eclipse.ui.*; -import org.eclipse.ui.progress.UIJob; - -/** - * A {@link SyncInfo} editor input used as input to a two-way or three-way - * compare viewer. It defines methods for accessing the three sides for the - * compare, and a name and image which is used when displaying the three way input - * in an editor. This input can alternatly be used to show compare results in - * a dialog by calling {@link CompareUI#openCompareDialog()}. - * <p> - * Supports saving the local resource that is changed in the editor. - * </p> - * <p> - * Use {@link SynchronizeCompareInput} to display more than one <code>SyncInfo</code> - * in an compare viewer. - * </p> - * @see SyncInfoModelElement - * @since 3.0 - */ -public final class SyncInfoCompareInput extends CompareEditorInput implements IResourceChangeListener { - - private MyDiffNode node; - private String description; - private IResource resource; - private IEditorPart editor; - - private static class MyDiffNode extends SyncInfoModelElement { - public MyDiffNode(IDiffContainer parent, SyncInfo info) { - super(parent, info); - } - public void fireChange() { - super.fireChange(); - } - } - - /** - * Creates a compare editor input based on an existing <code>SyncInfo</code>. - * - * @param description a description of the context of this sync info. This - * is displayed to the user. - * @param sync the <code>SyncInfo</code> used as the base for the compare input. - */ - public SyncInfoCompareInput(String description, SyncInfo sync) { - super(getDefaultCompareConfiguration()); - Assert.isNotNull(sync); - Assert.isNotNull(description); - this.description = description; - this.resource = sync.getLocal(); - this.node = new MyDiffNode(null, sync); - initializeContentChangeListeners(); - initializeResourceChangeListeners(); - } - - private static CompareConfiguration getDefaultCompareConfiguration() { - CompareConfiguration cc = new CompareConfiguration(); - //cc.setProperty(CompareConfiguration.USE_OUTLINE_VIEW, true); - return cc; - } - - private void initializeContentChangeListeners() { - ITypedElement te = node.getLeft(); - if (te instanceof IContentChangeNotifier) { - ((IContentChangeNotifier) te).addContentChangeListener(new IContentChangeListener() { - public void contentChanged(IContentChangeNotifier source) { - try { - saveChanges(new NullProgressMonitor()); - } catch (CoreException e) { - } - } - }); - } - } - - private void initializeResourceChangeListeners() { - ResourcesPlugin.getWorkspace().addResourceChangeListener(this); - } - - public void resourceChanged(IResourceChangeEvent event) { - IResourceDelta delta = event.getDelta(); - if (delta != null) { - IResourceDelta resourceDelta = delta.findMember(resource.getFullPath()); - if (resourceDelta != null) { - if (editor != null && editor instanceof IReusableEditor) { - UIJob job = new UIJob("") { //$NON-NLS-1$ - public IStatus runInUIThread(IProgressMonitor monitor) { - node.update(node.getSyncInfo()); - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.schedule(); - } - } - } - } - - /** - * We have to hook into the editors lifecycle in order to register/un-register resource - * change listeners. CompareEditorInputs aren't aware of the lifecycle of its containing - * editor - * <p> - * The side effect of not calling this method is that the input will not keep in sync with changes - * to the workspace resource. - * </p> - * @param editor the editor showing this input - */ - public void setCompareEditor(IEditorPart editor) { - Assert.isNotNull(editor); - this.editor = editor; - editor.getSite().getPage().addPartListener(new IPartListener() { - public void partActivated(IWorkbenchPart part) { - } - public void partBroughtToTop(IWorkbenchPart part) { - } - public void partClosed(IWorkbenchPart part) { - getCompareEditor().getSite().getPage().removePartListener(this); - dispose(); - SyncInfoCompareInput.this.editor = null; - } - public void partDeactivated(IWorkbenchPart part) { - } - public void partOpened(IWorkbenchPart part) { - } - }); - } - - public IEditorPart getCompareEditor() { - return this.editor; - } - - protected void dispose() { - ResourcesPlugin.getWorkspace().removeResourceChangeListener(this); - } - - /* - * (non-Javadoc) - * @see org.eclipse.compare.CompareEditorInput#getTitleImage() - */ - public Image getTitleImage() { - ImageRegistry reg = TeamUIPlugin.getPlugin().getImageRegistry(); - Image image = reg.get(ISharedImages.IMG_SYNC_VIEW); - if (image == null) { - image = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SYNC_VIEW).createImage(); - reg.put(ISharedImages.IMG_SYNC_VIEW, image); - } - return image; - } - - /* - * (non-Javadoc) - * @see org.eclipse.compare.CompareEditorInput#prepareInput(org.eclipse.core.runtime.IProgressMonitor) - */ - protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - // update the title now that the remote revision number as been fetched - // from the server - setTitle(getTitle()); - Utils.updateLabels(node.getSyncInfo(), getCompareConfiguration()); - try { - node.cacheContents(monitor); - } catch (TeamException e) { - throw new InvocationTargetException(e); - } - return node; - } - - /* - * (non-Javadoc) - * @see org.eclipse.compare.CompareEditorInput#getTitle() - */ - public String getTitle() { - return Policy.bind("SyncInfoCompareInput.title", node.getName()); //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.IEditorInput#getImageDescriptor() - */ - public ImageDescriptor getImageDescriptor() { - return TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SYNC_MODE_FREE); - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.IEditorInput#getToolTipText() - */ - public String getToolTipText() { - return Policy.bind("SyncInfoCompareInput.tooltip", description, node.getResource().getFullPath().toString()); //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object other) { - if (other == this) - return true; - if (other instanceof SyncInfoCompareInput) { - return getSyncInfo().equals(((SyncInfoCompareInput) other).getSyncInfo()); - } - return false; - } - - /* - * (non-Javadoc) - * @see CompareEditorInput#saveChanges(org.eclipse.core.runtime.IProgressMonitor) - */ - public void saveChanges(IProgressMonitor pm) throws CoreException { - super.saveChanges(pm); - if (node != null) { - try { - commit(pm, node); - } finally { - node.fireChange(); - setDirty(false); - } - } - } - - private static void commit(IProgressMonitor pm, DiffNode node) throws CoreException { - ITypedElement left = node.getLeft(); - if (left instanceof LocalResourceTypedElement) - ((LocalResourceTypedElement) left).commit(pm); - - ITypedElement right = node.getRight(); - if (right instanceof LocalResourceTypedElement) - ((LocalResourceTypedElement) right).commit(pm); - } - - public SyncInfo getSyncInfo() { - return node.getSyncInfo(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SyncInfoModelElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SyncInfoModelElement.java deleted file mode 100644 index 3189f9f6b..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SyncInfoModelElement.java +++ /dev/null @@ -1,249 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize.viewers; - -import org.eclipse.compare.ITypedElement; -import org.eclipse.compare.ResourceNode; -import org.eclipse.compare.structuremergeviewer.*; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.synchronize.SyncInfo; -import org.eclipse.team.core.variants.IResourceVariant; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.synchronize.LocalResourceTypedElement; -import org.eclipse.team.internal.ui.synchronize.RemoteResourceTypedElement; - -/** - * A diff node used to display the synchronization state for resources described by - * existing {@link SyncInfo} objects. The synchronization state for a node can - * change after it has been created. Since it implements the <code>ITypedElement</code> - * and <code>ICompareInput</code> interfaces it can be used directly to - * display the compare result in a <code>DiffTreeViewer</code> and as the - * input to any other compare/merge viewer. - * <p> - * Clients typically use this class as is, but may subclass if required. - * </p> - * @see DiffTreeViewer - * @see Differencer - */ -public class SyncInfoModelElement extends SynchronizeModelElement { - - private ITypedElement ancestor; - private SyncInfo info; - - /** - * Construct a <code>SyncInfoModelElement</code> for the given resource. - * - * @param set The set associated with the diff tree veiwer - * @param resource The resource for the node - */ - public SyncInfoModelElement(IDiffContainer parent, SyncInfo info) { - super(parent); - this.info = info; - // update state - setKind(info.getKind()); - // local - setLeft(createLocalTypeElement(info)); - // remote - setRight(createRemoteTypeElement(info)); - // base - setAncestor(createBaseTypeElement(info)); - - fireChange(); - } - - public void update(SyncInfo info) { - this.info = info; - // update state - setKind(info.getKind()); - // never have to update the local, it's always the workspace resource - // remote - RemoteResourceTypedElement rightEl = (RemoteResourceTypedElement)getRight(); - if(rightEl == null && info.getRemote() != null) { - setRight(createRemoteTypeElement(info)); - } else if(rightEl != null){ - rightEl.update(info.getRemote()); - } - // base - RemoteResourceTypedElement ancestorEl = (RemoteResourceTypedElement)getRight(); - if(ancestorEl == null && info.getBase() != null) { - setAncestor(createBaseTypeElement(info)); - } else if(ancestorEl != null){ - ancestorEl.update(info.getBase()); - } - - fireChange(); - } - - /* (non-Javadoc) - * @see org.eclipse.compare.structuremergeviewer.DiffElement#getKind() - */ - public int getKind() { - SyncInfo info = getSyncInfo(); - if (info != null) { - return info.getKind(); - } else { - return SyncInfo.IN_SYNC; - } - } - - /** - * We have to track the base because <code>DiffNode</code> doesn't provide a - * setter. See: - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=52261 - */ - public void setAncestor(ITypedElement ancestor) { - this.ancestor = ancestor; - } - - /* (non-Javadoc) - * @see org.eclipse.compare.structuremergeviewer.DiffNode#getAncestor() - */ - public ITypedElement getAncestor() { - return this.ancestor; - } - - /* (non-Javadoc) - * @see org.eclipse.compare.structuremergeviewer.DiffNode#getName() - */ - public String getName() { - IResource resource = getResource(); - if(resource != null) { - return resource.getName(); - } else { - return super.getName(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - public Object getAdapter(Class adapter) { - if(adapter == SyncInfo.class) { - return getSyncInfo(); - } - return super.getAdapter(adapter); - } - - /** - * Helper method that returns the resource associated with this node. A node is not - * required to have an associated local resource. - * @return the resource associated with this node or <code>null</code> if the local - * contributor is not a resource. - */ - public IResource getResource() { - ITypedElement element = getLeft(); - if(element instanceof ResourceNode) { - return ((ResourceNode)element).getResource(); - } - return null; - } - - /** - * Return true if the receiver's Subscriber and Resource are equal to that of object. - * @param object The object to test - * @return true has the same subsriber and resource - */ - public boolean equals(Object object) { - return this==object; - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - IResource resource = getResource(); - if (resource == null) { - return super.hashCode(); - } - return resource.hashCode(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - public String toString() { - return getResource() != null ? getResource().getFullPath().toString() : getName(); - } - - /** - * Cache the contents for the base and remote. - * @param monitor - */ - public void cacheContents(IProgressMonitor monitor) throws TeamException { - ITypedElement base = getAncestor(); - ITypedElement remote = getRight(); - int work = Math.min((remote== null ? 0 : 50) + (base == null ? 0 : 50), 10); - monitor.beginTask(null, work); - try { - if (base != null && base instanceof RemoteResourceTypedElement) { - ((RemoteResourceTypedElement)base).cacheContents(Policy.subMonitorFor(monitor, 50)); - } - if (remote != null && remote instanceof RemoteResourceTypedElement) { - ((RemoteResourceTypedElement)remote).cacheContents(Policy.subMonitorFor(monitor, 50)); - } - } finally { - monitor.done(); - } - } - - public SyncInfo getSyncInfo() { - return info; - } - - /** - * Create an ITypedElement for the given local resource. The returned ITypedElement - * will prevent editing of outgoing deletions. - */ - private static ITypedElement createTypeElement(final IResource resource, final int kind) { - if(resource != null) { - return new LocalResourceTypedElement(resource) { - public boolean isEditable() { - if(! resource.exists() && SyncInfo.getDirection(kind) == SyncInfo.OUTGOING && SyncInfo.getChange(kind) == SyncInfo.DELETION) { - return false; - } - return super.isEditable(); - } - }; - } - return null; - } - - /** - * Create an ITypedElement for the given remote resource. The contents for the remote resource - * will be retrieved from the given IStorage which is a local cache used to buffer the remote contents - */ - protected static ITypedElement createTypeElement(IResourceVariant remoteResource) { - return new RemoteResourceTypedElement(remoteResource); - } - - protected static ITypedElement createRemoteTypeElement(SyncInfo info) { - if(info != null && info.getRemote() != null) { - return createTypeElement(info.getRemote()); - } - return null; - } - - protected static ITypedElement createLocalTypeElement(SyncInfo info) { - if(info != null && info.getLocal() != null) { - return createTypeElement(info.getLocal(), info.getKind()); - } - return null; - } - - protected static ITypedElement createBaseTypeElement(SyncInfo info) { - if(info != null && info.getBase() != null) { - return createTypeElement(info.getBase()); - } - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeCompareInput.java deleted file mode 100644 index b3d6fb782..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeCompareInput.java +++ /dev/null @@ -1,276 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize.viewers; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.compare.*; -import org.eclipse.compare.internal.CompareEditor; -import org.eclipse.compare.internal.INavigatable; -import org.eclipse.compare.structuremergeviewer.DiffNode; -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.*; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.action.ToolBarManager; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.*; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.team.internal.ui.synchronize.LocalResourceTypedElement; -import org.eclipse.team.ui.ISharedImages; -import org.eclipse.team.ui.TeamImages; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.progress.IProgressService; - -/** - * A <code>CompareEditorInput</code> whose diff viewer shows the resources contained - * in a <code>SyncInfoSet</code>. The configuration of the diff viewer is determined by the - * <code>SyncInfoSetCompareConfiguration</code> that is used to create the - * <code>SynchronizeCompareInput</code>. - * - * uses the presentation model defined by the configuration. - * - * @since 3.0 - */ -public class SynchronizeCompareInput extends CompareEditorInput implements IContentChangeListener { - - private TreeViewerAdvisor diffViewerConfiguration; - private Viewer diffViewer; - private NavigationAction nextAction; - private NavigationAction previousAction; - - private boolean buffered = false; - - /** - * Create a <code>SynchronizeCompareInput</code> whose diff viewer is configured - * using the provided <code>SyncInfoSetCompareConfiguration</code>. - * @param configuration the compare configuration - * @param diffViewerConfiguration the diff viewer configuration - */ - public SynchronizeCompareInput(CompareConfiguration configuration, TreeViewerAdvisor diffViewerConfiguration) { - super(configuration); - this.diffViewerConfiguration = diffViewerConfiguration; - } - - public final Viewer createDiffViewer(Composite parent) { - this.diffViewer = internalCreateDiffViewer(parent, getViewerConfiguration()); - diffViewer.getControl().setData(CompareUI.COMPARE_VIEWER_TITLE, getTitle()); - - // buffered merge mode, don't ask for save when switching nodes since contents will be buffered in diff nodes - // and saved when the input is saved. - if(isBuffered()) { - getCompareConfiguration().setProperty(CompareEditor.CONFIRM_SAVE_PROPERTY, new Boolean(false)); - } - - /* - * This viewer can participate in navigation support in compare editor inputs. Note that - * it is currently accessing an internal compare interface that should be made public. See - * the following bug report https://bugs.eclipse.org/bugs/show_bug.cgi?id=48795. - */ - INavigatable nav= new INavigatable() { - public boolean gotoDifference(boolean next) { - return diffViewerConfiguration.navigate(next); - } - }; - diffViewer.getControl().setData(INavigatable.NAVIGATOR_PROPERTY, nav); - - nextAction = new NavigationAction(true); - previousAction = new NavigationAction(false); - nextAction.setCompareEditorInput(this); - previousAction.setCompareEditorInput(this); - - initializeToolBar(diffViewer.getControl().getParent()); - initializeDiffViewer(diffViewer); - diffViewerConfiguration.navigate(true); - return diffViewer; - } - - /** - * Create the diff viewer for this compare input. This method simply creates the widget. - * Any initialization is performed in the <code>initializeDiffViewer(StructuredViewer)</code> - * method. The default diff viewer is a <code>SyncInfoDiffTreeViewer</code>. Subclass may override. - * @param parent the parent <code>Composite</code> of the diff viewer to be created - * @param diffViewerConfiguration the configuration for the diff viewer - * @return the created diff viewer - */ - protected StructuredViewer internalCreateDiffViewer(Composite parent, TreeViewerAdvisor diffViewerConfiguration) { - TreeViewer viewer = new TreeViewerAdvisor.NavigableTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - GridData data = new GridData(GridData.FILL_BOTH); - viewer.getControl().setLayoutData(data); - diffViewerConfiguration.initializeViewer(viewer); - return viewer; - } - - protected TreeViewerAdvisor getViewerConfiguration() { - return diffViewerConfiguration; - } - - protected Viewer getViewer() { - return diffViewer; - } - - /** - * Initialize the diff viewer created for this compare input. If a subclass - * overrides the <code>createDiffViewer(Composite)</code> method, it should - * invoke this method on the created viewer in order to get the proper - * labelling in the compare input's contents viewers. - * @param viewer the diff viewer created by the compare input - */ - protected void initializeDiffViewer(Viewer viewer) { - if (viewer instanceof StructuredViewer) { - ((StructuredViewer) viewer).addOpenListener(new IOpenListener() { - public void open(OpenEvent event) { - ISelection s = event.getSelection(); - final SyncInfoModelElement node = getElement(s); - if (node != null) { - IResource resource = node.getResource(); - int kind = node.getKind(); - if (resource != null && resource.getType() == IResource.FILE) { - // Cache the contents because compare doesn't show progress - // when calling getContents on a diff node. - IProgressService manager = PlatformUI.getWorkbench().getProgressService(); - try { - node.cacheContents(new NullProgressMonitor()); - hookContentChangeListener(node); - } catch (TeamException e) { - Utils.handle(e); - } finally { - // Update the labels even if the content wasn't fetched correctly. This is - // required because the selection would still of changed. - Utils.updateLabels(node.getSyncInfo(), getCompareConfiguration()); - } - } - } - } - }); - } - } - - private void hookContentChangeListener(DiffNode node) { - ITypedElement left = node.getLeft(); - if(left instanceof IContentChangeNotifier) { - ((IContentChangeNotifier)left).addContentChangeListener(this); - } - ITypedElement right = node.getRight(); - if(right instanceof IContentChangeNotifier) { - ((IContentChangeNotifier)right).addContentChangeListener(this); - } - } - - public void contributeToToolBar(ToolBarManager tbm) { - if(nextAction != null && previousAction != null) { - tbm.appendToGroup("navigation", nextAction); //$NON-NLS-1$ - tbm.appendToGroup("navigation", previousAction); //$NON-NLS-1$ - } - } - - private void initializeToolBar(Composite parent) { - ToolBarManager tbm= CompareViewerPane.getToolBarManager(parent); - if (tbm != null) { - tbm.removeAll(); - tbm.add(new Separator("navigation")); //$NON-NLS-1$ - contributeToToolBar(tbm); - tbm.update(true); - } - } - - /* private */ SyncInfoModelElement getElement(ISelection selection) { - if (selection != null && selection instanceof IStructuredSelection) { - IStructuredSelection ss= (IStructuredSelection) selection; - if (ss.size() == 1) { - Object o = ss.getFirstElement(); - if(o instanceof SyncInfoModelElement) { - return (SyncInfoModelElement)o; - } - } - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.compare.CompareEditorInput#prepareInput(org.eclipse.core.runtime.IProgressMonitor) - */ - protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - return getViewerConfiguration().prepareInput(monitor); - } catch (TeamException e) { - throw new InvocationTargetException(e); - } - } - - /* - * (non-Javadoc) - * @see CompareEditorInput#saveChanges(org.eclipse.core.runtime.IProgressMonitor) - */ - public void saveChanges(IProgressMonitor pm) throws CoreException { - super.saveChanges(pm); - SynchronizeModelElement root = (SynchronizeModelElement)diffViewerConfiguration.getViewer().getInput(); - if (root != null) { - try { - commit(pm, root); - } finally { - setDirty(false); - } - } - } - - private static void commit(IProgressMonitor pm, DiffNode node) throws CoreException { - ITypedElement left = node.getLeft(); - if (left instanceof LocalResourceTypedElement) - ((LocalResourceTypedElement) left).commit(pm); - - ITypedElement right = node.getRight(); - if (right instanceof LocalResourceTypedElement) - ((LocalResourceTypedElement) right).commit(pm); - - //node.getC - IDiffElement[] children = (IDiffElement[])node.getChildren(); - for (int i = 0; i < children.length; i++) { - commit(pm, (DiffNode)children[i]); - } - } - - /* (non-Javadoc) - * @see org.eclipse.compare.IContentChangeListener#contentChanged(org.eclipse.compare.IContentChangeNotifier) - */ - public void contentChanged(IContentChangeNotifier source) { - try { - if (isBuffered()) { - setDirty(true); - } else if (source instanceof DiffNode) { - commit(new NullProgressMonitor(), (DiffNode) source); - } else if (source instanceof LocalResourceTypedElement) { - ((LocalResourceTypedElement) source).commit(new NullProgressMonitor()); - } - } catch (CoreException e) { - Utils.handle(e); - } - } - - /* (non-Javadoc) - * @see org.eclipse.compare.CompareEditorInput#getImageDescriptor() - */ - public ImageDescriptor getImageDescriptor() { - return TeamImages.getImageDescriptor(ISharedImages.IMG_COMPARE_VIEW); - } - - /** - * Returns <code>true</code> if this compare input will buffer node content changes until the input is saved, - * otherwise content changes are saved to disk immediatly when each node is saved in the content merge viewer. - */ - public boolean isBuffered() { - return buffered; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeDialog.java deleted file mode 100644 index 5e291e6b0..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeDialog.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize.viewers; - -import org.eclipse.compare.CompareEditorInput; -import org.eclipse.compare.internal.ResizableDialog; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jface.dialogs.*; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.util.*; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.*; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.team.ui.TeamUI; -import org.eclipse.team.ui.synchronize.*; - -/** - * A dialog that displays a synchronize participant. There are some cases when it - * is more appropriate to display synchronization information in a dialog instead of - * in the Synchronize View. This class provides a modal context in which to show - * this. - * <p> - * To allow a user to transfer this synchronization state to the Synchronize View simply - * set the participant. - * </p><p> - * The dialog tracks changes made in the content merge viewers, displays a change - * indication and will ensure that changes are saved when the dialog is closed. - * </p><p> - * Buffered or un-buffered compare editor inputs are supported. - * </p> - * @see SynchronizeCompareInput - * @since 3.0 - */ -public class SynchronizeDialog extends ResizableDialog implements IPropertyChangeListener { - - private CompareEditorInput fCompareEditorInput; - private ISynchronizeParticipant participant; - private Button saveButton; - private Button rememberParticipantButton; - private String title; - private boolean isDirty = false; - - /** - * Creates a dialog with the given title and input. The input is not created until the dialog - * is opened. - * - * @param shell the parent shell or <code>null</code> to create a top level shell. - * @param title the shell's title - * @param input the compare input to show in the dialog - */ - public SynchronizeDialog(Shell shell, String title, CompareEditorInput input) { - super(shell, null); - this.title = title; - Assert.isNotNull(input); - fCompareEditorInput= input; - fCompareEditorInput.addPropertyChangeListener(this); - } - - public void setSynchronizeParticipant(ISynchronizeParticipant participant) { - this.participant = participant; - } - - /* (non-Javadoc) - * Method declared on Dialog. - */ - protected void createButtonsForButtonBar(Composite parent) { - createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); - } - - /* (non-Javadoc) - * Method declared on Dialog. - */ - protected Control createDialogArea(Composite parent2) { - Composite parent = (Composite) super.createDialogArea(parent2); - Control c = fCompareEditorInput.createContents(parent); - c.setLayoutData(new GridData(GridData.FILL_BOTH)); - if (participant != null) { - rememberParticipantButton = new Button(parent, SWT.CHECK); - rememberParticipantButton.setText(Policy.bind("ParticipantCompareDialog.1")); //$NON-NLS-1$ - } - Shell shell = c.getShell(); - shell.setText(title); - shell.setImage(fCompareEditorInput.getTitleImage()); - Dialog.applyDialogFont(parent2); - return parent; - } - - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int) - */ - protected void buttonPressed(int buttonId) { - if (fCompareEditorInput.isSaveNeeded() && MessageDialog.openConfirm(getShell(), Policy.bind("ParticipantCompareDialog.2"), Policy.bind("ParticipantCompareDialog.3"))) { //$NON-NLS-1$ //$NON-NLS-2$ - BusyIndicator.showWhile(null, new Runnable() { - public void run() { - try { - fCompareEditorInput.saveChanges(new NullProgressMonitor()); - } catch (CoreException e) { - Utils.handle(e); - } - } - }); - } - if(buttonId == IDialogConstants.OK_ID && isRememberParticipant()) { - rememberParticipant(); - } - super.buttonPressed(buttonId); - } - - protected boolean isRememberParticipant() { - return getParticipant() != null && rememberParticipantButton != null && rememberParticipantButton.getSelection(); - } - - protected void rememberParticipant() { - if(getParticipant() != null) { - ISynchronizeManager mgr = TeamUI.getSynchronizeManager(); - ISynchronizeView view = mgr.showSynchronizeViewInActivePage(); - mgr.addSynchronizeParticipants(new ISynchronizeParticipant[] {participant}); - view.display(participant); - } - } - - public void propertyChange(PropertyChangeEvent event) { - if (fCompareEditorInput != null) { - if(fCompareEditorInput.isSaveNeeded()) { - // the dirty flag is required because there is a compare bug that causes the dirty bit to be reset sometimes - // although the underlying compare editor input is still dirty. - isDirty = true; - getShell().setText(title + " *"); //$NON-NLS-1$ - } else { - getShell().setText(title); - } - } - } - - protected Object getParticipant() { - return participant; - } - - protected CompareEditorInput getCompareEditorInput() { - return fCompareEditorInput; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElement.java deleted file mode 100644 index 0c05f4ace..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElement.java +++ /dev/null @@ -1,190 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize.viewers; - -import org.eclipse.compare.structuremergeviewer.*; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.*; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.util.*; -import org.eclipse.team.core.synchronize.SyncInfo; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.ui.model.IWorkbenchAdapter; - -/** - * A model element that can be shown in viewers. - * - * @since 3.0 - */ -public abstract class SynchronizeModelElement extends DiffNode implements IAdaptable { - - public static final String BUSY_PROPERTY = TeamUIPlugin.ID + ".busy"; //$NON-NLS-1$ - public static final String PROPAGATED_CONFLICT_PROPERTY = TeamUIPlugin.ID + ".conflict"; //$NON-NLS-1$ - - /* - * Internal flags bits for stroing properties in the flags variable - */ - private static final int BUSY_FLAG = 1; - private static final int PROPAGATED_CONFLICT_FLAG = 2; - - // Instance variable containing the flags for this node - private int flags; - private ListenerList listeners; - - public SynchronizeModelElement(IDiffContainer parent) { - super(parent, SyncInfo.IN_SYNC); - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - public Object getAdapter(Class adapter) { - return Platform.getAdapterManager().getAdapter(this, adapter); - } - - public synchronized void addPropertyChangeListener(IPropertyChangeListener listener) { - if (listeners == null) { - listeners = new ListenerList(); - } - listeners.add(listener); - } - - public synchronized void removePropertyChangeListener(IPropertyChangeListener listener) { - if (listeners != null) { - listeners.remove(listener); - if (listeners.isEmpty()) { - listeners = null; - } - } - } - - /** - * Return whether this node has the given property set. - * @param propertyName the flag to test - * @return <code>true</code> if the property is set - */ - public boolean getProperty(String propertyName) { - return (getFlags() & getFlag(propertyName)) > 0; - } - - /** - * Add the flag to the flags for this node - * @param propertyName the flag to add - */ - public void setProperty(String propertyName, boolean value) { - if (value) { - if (!getProperty(propertyName)) { - int flag = getFlag(propertyName); - flags |= flag; - firePropertyChange(propertyName); - } - } else { - if (getProperty(propertyName)) { - int flag = getFlag(propertyName); - flags ^= flag; - firePropertyChange(propertyName); - } - } - } - - public void setPropertyToRoot(String propertyName, boolean value) { - if (value) { - addToRoot(propertyName); - } else { - removeToRoot(propertyName); - } - } - - public void fireChanges() { - fireChange(); - } - - public ImageDescriptor getImageDescriptor(Object object) { - IResource resource = getResource(); - if(resource != null) { - IWorkbenchAdapter adapter = (IWorkbenchAdapter)((IAdaptable) resource).getAdapter(IWorkbenchAdapter.class); - return adapter.getImageDescriptor(resource); - } - return null; - } - - public abstract IResource getResource(); - - private void addToRoot(String flag) { - setProperty(flag, true); - SynchronizeModelElement parent = (SynchronizeModelElement)getParent(); - if (parent != null) { - if (parent.getProperty(flag)) return; - parent.addToRoot(flag); - } - } - - private void firePropertyChange(String propertyName) { - Object[] allListeners; - synchronized(this) { - if (listeners == null) return; - allListeners = listeners.getListeners(); - } - boolean set = getProperty(propertyName); - final PropertyChangeEvent event = new PropertyChangeEvent(this, propertyName, Boolean.valueOf(!set), Boolean.valueOf(set)); - for (int i = 0; i < allListeners.length; i++) { - Object object = allListeners[i]; - if (object instanceof IPropertyChangeListener) { - final IPropertyChangeListener listener = (IPropertyChangeListener)object; - Platform.run(new ISafeRunnable() { - public void handleException(Throwable exception) { - // Exceptions logged by the platform - } - public void run() throws Exception { - listener.propertyChange(event); - } - }); - } - } - } - - private int getFlag(String propertyName) { - if (propertyName == BUSY_PROPERTY) { - return BUSY_FLAG; - } else if (propertyName == PROPAGATED_CONFLICT_PROPERTY) { - return PROPAGATED_CONFLICT_FLAG; - } - return 0; - } - - private int getFlags() { - return flags; - } - - private boolean hasChildWithFlag(String flag) { - IDiffElement[] childen = getChildren(); - for (int i = 0; i < childen.length; i++) { - IDiffElement element = childen[i]; - if (((SynchronizeModelElement)element).getProperty(flag)) { - return true; - } - } - return false; - } - - private void removeToRoot(String flag) { - setProperty(flag, false); - SynchronizeModelElement parent = (SynchronizeModelElement)getParent(); - if (parent != null) { - // If the parent doesn't have the tag, no recalculation is required - // Also, if the parent still has a child with the tag, no recalculation is needed - if (parent.getProperty(flag) && !parent.hasChildWithFlag(flag)) { - // The parent no longer has the flag so propogate the reclaculation - parent.removeToRoot(flag); - } - } - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElementLabelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElementLabelProvider.java deleted file mode 100644 index ca14ae936..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElementLabelProvider.java +++ /dev/null @@ -1,207 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize.viewers; - -import java.util.*; - -import org.eclipse.compare.CompareConfiguration; -import org.eclipse.compare.structuremergeviewer.DiffNode; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.*; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.*; -import org.eclipse.team.core.synchronize.SyncInfo; -import org.eclipse.team.internal.ui.*; -import org.eclipse.team.ui.ISharedImages; -import org.eclipse.ui.internal.WorkbenchColors; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -/** - * A label provider that decorates viewers showing - * {@link org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement}. - * - * @since 3.0 - */ -public class SynchronizeModelElementLabelProvider extends LabelProvider implements IColorProvider { - - // Cache for folder images that have been overlayed with conflict icon - private Map fgImageCache; - - // Contains direction images - CompareConfiguration compareConfig = new CompareConfiguration(); - - // Used as the base label provider for retreiving image and text from - // the workbench adapter. - private WorkbenchLabelProvider workbenchLabelProvider = new WorkbenchLabelProvider(); - - /** - * Decorating label provider that also support color providers - */ - public static class DecoratingColorLabelProvider extends DecoratingLabelProvider implements IColorProvider { - - public DecoratingColorLabelProvider(ILabelProvider provider, ILabelDecorator decorator) { - super(provider, decorator); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object) - */ - public Color getForeground(Object element) { - ILabelProvider p = getLabelProvider(); - if (p instanceof IColorProvider) { - return ((IColorProvider) p).getForeground(element); - } - return null; - } - - /* - * (non-Javadoc) - * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object) - */ - public Color getBackground(Object element) { - ILabelProvider p = getLabelProvider(); - if (p instanceof IColorProvider) { - return ((IColorProvider) p).getBackground(element); - } - return null; - } - } - - public SynchronizeModelElementLabelProvider() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object) - */ - public Color getForeground(Object element) { - if (element instanceof SynchronizeModelElement) { - SynchronizeModelElement node = (SynchronizeModelElement)element; - if(node.getProperty(SynchronizeModelElement.BUSY_PROPERTY)) { - return WorkbenchColors.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW); - } - } - return null; - } - - /* - * (non-Javadoc) - * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object) - */ - public Color getBackground(Object element) { - return null; - } - - /* - * (non-Javadoc) - * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object) - */ - public Image getImage(Object element) { - Image base = workbenchLabelProvider.getImage(element); - if (base != null) { - if (element instanceof DiffNode) { - DiffNode syncNode = (DiffNode) element; - int kind = syncNode.getKind(); - Image decoratedImage; - decoratedImage = getCompareImage(base, kind); - if (syncNode.hasChildren()) { - // The reason we still overlay the compare image is to - // ensure that the image width for all images shown in the viewer - // are consistent. - return propagateConflicts(decoratedImage, syncNode); - } else { - return decoratedImage; - } - } - } - return base; - } - - /* - * (non-Javadoc) - * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object) - */ - public String getText(Object element) { - String base = workbenchLabelProvider.getText(element); - if (element instanceof DiffNode) { - if (TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_VIEW_SYNCINFO_IN_LABEL)) { - // if the folder is already conflicting then don't bother - // propagating the conflict - int kind = ((DiffNode) element).getKind(); - if (kind != SyncInfo.IN_SYNC) { - String syncKindString = SyncInfo.kindToString(kind); - return Policy.bind("TeamSubscriberSyncPage.labelWithSyncKind", base, syncKindString); //$NON-NLS-1$ - } - } - } - return base; - } - - protected Image getCompareImage(Image base, int kind) { - switch (kind & SyncInfo.DIRECTION_MASK) { - case SyncInfo.OUTGOING : - kind = (kind & ~SyncInfo.OUTGOING) | SyncInfo.INCOMING; - break; - case SyncInfo.INCOMING : - kind = (kind & ~SyncInfo.INCOMING) | SyncInfo.OUTGOING; - break; - } - return compareConfig.getImage(base, kind); - } - - private Image propagateConflicts(Image base, DiffNode element) { - // if the folder is already conflicting then don't bother propagating - // the conflict - int kind = element.getKind(); - if ((kind & SyncInfo.DIRECTION_MASK) != SyncInfo.CONFLICTING) { - if (hasDecendantConflicts(element)) { - ImageDescriptor overlay = new OverlayIcon(base, new ImageDescriptor[]{TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_CONFLICT_OVR)}, new int[]{OverlayIcon.BOTTOM_LEFT}, new Point(base.getBounds().width, base.getBounds().height)); - if (fgImageCache == null) { - fgImageCache = new HashMap(10); - } - Image conflictDecoratedImage = (Image) fgImageCache.get(overlay); - if (conflictDecoratedImage == null) { - conflictDecoratedImage = overlay.createImage(); - fgImageCache.put(overlay, conflictDecoratedImage); - } - return conflictDecoratedImage; - } - } - return base; - } - - /** - * Return whether this diff node has descendant conflicts in the view in which it appears. - * @return whether the node has descendant conflicts - */ - private boolean hasDecendantConflicts(DiffNode node) { - if(node instanceof SynchronizeModelElement) { - return ((SynchronizeModelElement)node).getProperty(SynchronizeModelElement.PROPAGATED_CONFLICT_PROPERTY); - } - return false; - } - - /* - * (non-Javadoc) - * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose() - */ - public void dispose() { - compareConfig.dispose(); - if (fgImageCache != null) { - Iterator it = fgImageCache.values().iterator(); - while (it.hasNext()) { - Image element = (Image) it.next(); - element.dispose(); - } - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElementSorter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElementSorter.java deleted file mode 100644 index 7056320c6..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/SynchronizeModelElementSorter.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize.viewers; - -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.ui.views.navigator.ResourceSorter; - -/** - * This class sorts <code>SyncInfoModelElement</code> instances. - * It is not thread safe so it should not be reused between views. - */ -public class SynchronizeModelElementSorter extends ResourceSorter { - - public SynchronizeModelElementSorter() { - super(ResourceSorter.NAME); - } - - /* (non-Javadoc) - * Method declared on ViewerSorter. - */ - public int compare(Viewer viewer, Object o1, Object o2) { - IResource resource1 = getResource(o1); - IResource resource2 = getResource(o2); - int result; - if (resource1 != null && resource2 != null) { - result = super.compare(viewer, resource1, resource2); - } else { - result = super.compare(viewer, o1, o2); - } - return result; - } - - protected IResource getResource(Object obj) { - IResource[] resources = Utils.getResources(new Object[] {obj}); - return resources.length == 1 ? resources[0] : null; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/TreeViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/TreeViewerAdvisor.java deleted file mode 100644 index db098cf29..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/TreeViewerAdvisor.java +++ /dev/null @@ -1,347 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize.viewers; - -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.jface.viewers.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.synchronize.SyncInfoTree; -import org.eclipse.team.internal.ui.*; -import org.eclipse.team.internal.ui.synchronize.*; -import org.eclipse.team.internal.ui.synchronize.actions.ExpandAllAction; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.ui.IWorkbenchPartSite; -import org.eclipse.ui.internal.dialogs.ContainerCheckedTreeViewer; - -/** - * A <code>TreeViewerAdvisor</code> that works with TreeViewers. Two default - * tree viewers are provided that support navigation: <code>NavigableTreeViewer</code> - * and <code>NavigableCheckboxTreeViewer</code>. - * <p> - * Note that this advisor can be used with any tree viewer. By default it provides an - * expand all action, double click behavior on containers, and navigation support for - * tree viewers. - * </p><p> - * By default this advisor supports hierarchical models and honour the compressed - * folder Team preference for showing the sync set as compressed folders. Subclasses - * can provide their own presentation models. - * <p> - * @since 3.0 - */ -public class TreeViewerAdvisor extends StructuredViewerAdvisor implements IPropertyChangeListener { - - /** - * Interface used to implement navigation for tree viewers. This interface is used by - * {@link TreeViewerAdvisor#navigate(TreeViewer, boolean, boolean, boolean) to open - * selections and navigate. - */ - public interface ITreeViewerAccessor { - - public void createChildren(TreeItem item); - public void openSelection(); - } - - /** - * A navigable checkboxec tree viewer that will work with the <code>navigate</code> method of - * this advisor. - */ - public static class NavigableCheckboxTreeViewer extends ContainerCheckedTreeViewer implements ITreeViewerAccessor { - public NavigableCheckboxTreeViewer(Composite parent, int style) { - super(parent, style); - } - - public void createChildren(TreeItem item) { - super.createChildren(item); - } - - public void openSelection() { - fireOpen(new OpenEvent(this, getSelection())); - } - } - - /** - * A navigable tree viewer that will work with the <code>navigate</code> method of - * this advisor. - */ - public static class NavigableTreeViewer extends TreeViewer implements ITreeViewerAccessor { - public NavigableTreeViewer(Composite parent, int style) { - super(parent, style); - } - - public void createChildren(TreeItem item) { - super.createChildren(item); - } - - public void openSelection() { - fireOpen(new OpenEvent(this, getSelection())); - } - } - - private ExpandAllAction expandAllAction; - - /** - * Create an advisor that will allow viewer contributions with the given <code>targetID</code>. This - * advisor will provide a presentation model based on the given sync info set. Note that it's important - * to call {@link #dispose()} when finished with an advisor. - * - * @param targetID the targetID defined in the viewer contributions in a plugin.xml file. - * @param site the workbench site with which to register the menuId. Can be <code>null</code> in which - * case a site will be found using the default workbench page. - * @param set the set of <code>SyncInfo</code> objects that are to be shown to the user. - */ - public TreeViewerAdvisor(String menuId, IWorkbenchPartSite site, SyncInfoTree set) { - super(menuId,site, set); - TeamUIPlugin.getPlugin().getPreferenceStore().addPropertyChangeListener(this); - } - - /** - * Create a tree viewer advisor that will provide a presentation model based on the given - * sync info set. Note that it's important to call {@link #dispose()} when finished with - * an advisor. - * - * @param set the set of <code>SyncInfo</code> objects that are to be shown to the user. - */ - public TreeViewerAdvisor(SyncInfoTree set) { - this(null, null, set); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor#dispose() - */ - public void dispose() { - TeamUIPlugin.getPlugin().getPreferenceStore().removePropertyChangeListener(this); - super.dispose(); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor#navigate(boolean) - */ - public boolean navigate(boolean next) { - return TreeViewerAdvisor.navigate((TreeViewer)getViewer(), next, true, false); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent event) { - if (getViewer() != null && event.getProperty().equals(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS)) { - try { - prepareInput(null); - setInput(getViewer()); - } catch (TeamException e) { - TeamUIPlugin.log(e); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor#initializeViewer(org.eclipse.jface.viewers.StructuredViewer) - */ - public boolean validateViewer(StructuredViewer viewer) { - return viewer instanceof AbstractTreeViewer; - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor#fillContextMenu(org.eclipse.jface.viewers.StructuredViewer, org.eclipse.jface.action.IMenuManager) - */ - protected void fillContextMenu(StructuredViewer viewer, IMenuManager manager) { - manager.add(expandAllAction); - manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor#getDiffNodeController() - */ - protected SynchronizeModelProvider getModelProvider() { - if(getShowCompressedFolders()) { - return new CompressedFoldersModelProvider((SyncInfoTree)getSyncInfoSet()); - } - return new HierarchicalModelProvider((SyncInfoTree)getSyncInfoSet()); - } - - /** - * Handles a double-click event from the viewer. Expands or collapses a folder when double-clicked. - * - * @param viewer the viewer - * @param event the double-click event - */ - protected void handleDoubleClick(StructuredViewer viewer, DoubleClickEvent event) { - IStructuredSelection selection = (IStructuredSelection) event.getSelection(); - Object element = selection.getFirstElement(); - AbstractTreeViewer treeViewer = (AbstractTreeViewer) getViewer(); - if (treeViewer.getExpandedState(element)) { - treeViewer.collapseToLevel(element, AbstractTreeViewer.ALL_LEVELS); - } else { - TreeViewerAdvisor.navigate((TreeViewer)getViewer(), true /* next */, false /* no-open */, true /* only-expand */); - } - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor#initializeActions(org.eclipse.jface.viewers.StructuredViewer) - */ - protected void initializeActions(StructuredViewer viewer) { - super.initializeActions(viewer); - expandAllAction = new ExpandAllAction((AbstractTreeViewer) viewer); - Utils.initAction(expandAllAction, "action.expandAll."); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor#initializeListeners(org.eclipse.jface.viewers.StructuredViewer) - */ - protected void initializeListeners(StructuredViewer viewer) { - viewer.addDoubleClickListener(new IDoubleClickListener() { - public void doubleClick(DoubleClickEvent event) { - handleDoubleClick(getViewer(), event); - } - }); - } - - /** - * Return the state of the compressed folder setting. - * - * @return the state of the compressed folder setting. - */ - private boolean getShowCompressedFolders() { - return TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS); - } - - private static TreeItem findNextPrev(TreeViewer viewer, TreeItem item, boolean next) { - if (item == null || !(viewer instanceof ITreeViewerAccessor)) - return null; - TreeItem children[] = null; - ITreeViewerAccessor treeAccessor = (ITreeViewerAccessor) viewer; - if (!next) { - TreeItem parent = item.getParentItem(); - if (parent != null) - children = parent.getItems(); - else - children = item.getParent().getItems(); - if (children != null && children.length > 0) { - // goto previous child - int index = 0; - for (; index < children.length; index++) - if (children[index] == item) - break; - if (index > 0) { - item = children[index - 1]; - while (true) { - treeAccessor.createChildren(item); - int n = item.getItemCount(); - if (n <= 0) - break; - item.setExpanded(true); - item = item.getItems()[n - 1]; - } - // previous - return item; - } - } - // go up - return parent; - } else { - item.setExpanded(true); - treeAccessor.createChildren(item); - if (item.getItemCount() > 0) { - // has children: go down - children = item.getItems(); - return children[0]; - } - while (item != null) { - children = null; - TreeItem parent = item.getParentItem(); - if (parent != null) - children = parent.getItems(); - else - children = item.getParent().getItems(); - if (children != null && children.length > 0) { - // goto next child - int index = 0; - for (; index < children.length; index++) - if (children[index] == item) - break; - if (index < children.length - 1) { - // next - return children[index + 1]; - } - } - // go up - item = parent; - } - } - return item; - } - - private static void setSelection(TreeViewer viewer, TreeItem ti, boolean fireOpen, boolean expandOnly) { - if (ti != null) { - Object data= ti.getData(); - if (data != null) { - // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106 - ISelection selection = new StructuredSelection(data); - if (expandOnly) { - viewer.expandToLevel(data, 0); - } else { - viewer.setSelection(selection, true); - ISelection currentSelection = viewer.getSelection(); - if (fireOpen && currentSelection != null && selection.equals(currentSelection)) { - if (viewer instanceof ITreeViewerAccessor) { - ((ITreeViewerAccessor) viewer).openSelection(); - } - } - } - } - } - } - - /** - * Selects the next (or previous) node of the current selection. - * If there is no current selection the first (last) node in the tree is selected. - * Wraps around at end or beginning. - * Clients may not override. - * - * @param next if <code>true</code> the next node is selected, otherwise the previous node - * @return <code>true</code> if at end (or beginning) - */ - public static boolean navigate(TreeViewer viewer, boolean next, boolean fireOpen, boolean expandOnly) { - Tree tree = viewer.getTree(); - if (tree == null) - return false; - TreeItem item = null; - TreeItem children[] = tree.getSelection(); - if (children != null && children.length > 0) - item = children[0]; - if (item == null) { - children = tree.getItems(); - if (children != null && children.length > 0) { - item = children[0]; - if (item != null && item.getItemCount() <= 0) { - setSelection(viewer, item, fireOpen, expandOnly); // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106 - return false; - } - } - } - while (true) { - item = findNextPrev(viewer, item, next); - if (item == null) - break; - if (item.getItemCount() <= 0) - break; - } - if (item != null) { - setSelection(viewer, item, fireOpen, expandOnly); // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106 - return false; - } - return true; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/UnchangedResourceModelElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/UnchangedResourceModelElement.java deleted file mode 100644 index a2b17e0d5..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/UnchangedResourceModelElement.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.synchronize.viewers; - -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; - -/** - * DiffNode that represents a resource that is in sync. - */ -public class UnchangedResourceModelElement extends SynchronizeModelElement implements IAdaptable { - - private IResource resource; - - public UnchangedResourceModelElement(IDiffContainer parent, IResource resource) { - super(parent); - this.resource = resource; - } - - /** - * @return Returns the resource. - */ - public IResource getResource() { - return resource; - } - - /* (non-Javadoc) - * @see org.eclipse.compare.structuremergeviewer.DiffNode#getName() - */ - public String getName() { - return resource.getName(); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/package.html b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/package.html deleted file mode 100644 index 6890ad44e..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/package.html +++ /dev/null @@ -1,82 +0,0 @@ -<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en"> -<html> -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=iso-8859-1"> - <meta name="Author" content="IBM"> - <title>Package-level Javadoc</title> -</head> -<body> -<p> -Application programming interfaces for displaying synchronization -states and variants.</p> -<h2>Package Specification</h2> -<p>This package contains classes that support displaying -synchronization information described by SyncInfo. If you consider the -synchronization model described by the classes in -org.eclipse.team.core.synchronize as the physical representation of -resource variants then the classes in this package allow you to control -how the model is presented to the user. One key feature of these APIs -is that they support managing dynamic models.<br> -</p> -<p>There is no specific support for the Synchronize View in this -package. Instead, the classes here can be used to build a page that can -be shown in the view, but they can also be used to show synchronization -information in dialogs, wizards, and editors.<br> -</p> -<p>The central abstractions for presenting synchronization state are:<br> -</p> -<p>- SynchronizeModelProvider, SynchronizeModelElement: are the -building blocks for -describing the logical structure of a synchronization model.<br> -- StructuredViewerAdvisor: are used to -display the logical structure to the user and define the basics such as -the SynchronizeModelProvider, label provider, and context menus.<br> -- SyncInfoCompareInput: is used to show a comparison between a local -resource and a variant in a compare editor.<br> -- SyncInfoSetCompareInput: is used to showing a set of variants in a -compare editor<br> -</p> -<p>Default implementations are provided and there are many levels of -customizations available.<br> -</p> -<h2>Basic Example</h2> -If you have a synchronization model described in a SyncInfoTree and -would like to show it to the user in a simple resource hierarchical -tree viewers you would:<br> -<br> -SyncInfoTree syncTree = getSyncTree();<br> -DiffTreeViewerConfiguration viewerConfiguration = new -DiffTreeViewerConfiguration(syncTree);<br> -TreeViewer viewer = new TreeViewer(parent);<br> -viewerConfiguration.initializeViewer(viewer);<br> -...<br> -viewerConfiguration.dispose();<br> -<br> -Some items of interest in the above example: (1) the viewer -configuration is used to add behavior to different types of tree -viewers and by default will build a hierarchical logical model of the -synchronization info and, (2) the default label provider will show the -nodes with resource decorations plus the standard diff change markers, -(3) the default context menu action is expand all plus any object -contributions.<br> -<br> -Another example, you would like to add additional label decorations, -and actions defined as viewerContribution in your plugin.xml.<br> -<br> -SyncInfoTree syncTree = getSyncTree();<br> -DiffTreeViewerConfiguration viewerConfiguration = new -DiffTreeViewerConfiguration("org.eclipse.team.example.actions", -syncTree) {<br> - protected ILabelProvider getLabelProvider() {<br> - return new -SyncInfoLabelProvider.DecoratingColorLabelProvider(new -SyncInfoLabelProvider(), new MyCustorDecorator());<br> - }<br> -}<br> -TreeViewer viewer = new TreeViewer(parent);<br> -viewerConfiguration.initializeViewer(viewer);<br> -...<br> -viewerConfiguration.dispose();<br> -</body> -</html> |