input
stringlengths
10
828
output
stringlengths
5
107
protected void handle source browse button pressed string selected file query zip file to import if selected file null be sure it is valid before we go setting any names if selected file equals source name field get text validate source file selected file set source name selected file selection group set focus
open a file dialog so that the user can specify the source
private void set bold ranges styled text styled text int bold ranges for int i 0 i bold ranges length i style range r new style range bold ranges i 0 bold ranges i 1 null null swt bold styled text set style range r
sets the styled texts bold ranges
public void set populated this populated true
set whether or not population has happened for the receiver to true
protected boolean validate source group if there is nothing being provided to the input then there is a problem if this current provider null set message source empty message enable button group false return false else enable button group true return true
answer a boolean indicating whether selfs source specification
public void set focus if editor composite null last navigated text null current text null editor composite set focus
asks this part to take focus within the workbench
protected string query zip file to import file dialog dialog new file dialog source name field get shell swt open dialog set filter extensions file import mask dialog set text data transfer messages archive import source title string current source string source name field get text int last separator index current source string last index of file separator if last separator index 1 dialog set filter path current source string substring 0 last separator index return dialog open
opens a file selection dialog and returns a string representing the
protected tar entry create container ipath pathname tar entry existing entry tar entry directory entry cache get pathname if existing entry null return existing entry tar entry parent if pathname segment count 1 parent root else parent create container pathname remove last segments 1 tar entry new entry new tar entry pathname to string new entry set file type tar entry directory directory entry cache put pathname new entry list child list new array list children put new entry child list list parent child list list children get parent parent child list add new entry return new entry
creates a new container tar entry with the specified name iff it has
protected void create file tar entry entry ipath pathname new path entry get name tar entry parent if pathname segment count 1 parent root else parent tar entry directory entry cache get pathname remove last segments 1 list child list list children get parent child list add entry
creates a new tar file entry with the specified name
public resource attributes get resource attributes object element resource attributes attributes new resource attributes tar entry entry tar entry element attributes set executable entry get mode 0100 0 attributes set read only entry get mode 0200 0 return attributes
returns the resource attributes for this file
private void set link ranges styled text styled text int link ranges color fg styled text get display get system color swt color blue color fg jface colors get hyperlink text styled text get shell get display for int i 0 i link ranges length i style range r new style range link ranges i 0 link ranges i 1 fg null styled text set style range r hyperlink ranges add r
sets the styled texts link blue ranges
public tar file get tar file return tar file
returns the tar file that this provider provides structure for
private imarker find marker string path string long id ipath path new path path string iresource resource workspace get root find member path if resource null return resource get marker id return null
locates and returns the marker associated with the given attributes
private void lazy init object markers if workspace null if markers null markers length 0 this workspace imarker markers 0 get resource get workspace
initializes the transfer mechanism if necessary
private imarker read marker data input stream data in throws ioexception marker serialization format is as follows string path of resource for marker int marker id string path data in read utf long id data in read long return find marker path id
reads and returns a single marker from the given stream
protected void create source group composite parent create root directory group parent create file selection group parent create buttons group parent
create the import source specification widgets
protected boolean validate source group if there is nothing being provided to the input then there is a problem if this zip current provider null this tar current provider null set message source empty message enable button group false return false list resources to export selection group get all white checked items if resources to export size 0 set error message data transfer messages file import none selected return false enable button group true set error message null return true
answer a boolean indicating whether selfs source specification
public istatus get status istatus errors new istatus error table size error table to array errors return new multi status platform ui plugin id istatus ok errors data transfer messages file system export operation problems exporting null
returns the status of the export operation
public boolean finish list resources to export get white checked resources if ensure target is valid new file get destination value return false save dirty editors if possible but do not stop if not all are saved save dirty editors about to invoke the operation so save our state save widget values return execute export operation new file system export operation null resources to export get destination value this
the finish button was pressed
private iresource read resource data input stream data in throws ioexception int type data in read int string path data in read utf switch type case iresource folder return workspace get root get folder new path path case iresource file return workspace get root get file new path path case iresource project return workspace get root get project path throw new illegal argument exception unknown resource type in resource transfer read resource non nls 1
reads a resource from the given stream
protected void enable button group boolean enable select types button set enabled enable select all button set enabled enable deselect all button set enabled enable
enable or disable the button group
private void create options area composite work area composite options group new composite work area swt none options group set layout new grid layout options group set layout data new grid data grid data fill horizontal copy checkbox new button options group swt check copy checkbox set text data transfer messages wizard projects import page copy projects into workspace copy checkbox set layout data new grid data grid data fill horizontal copy checkbox add selection listener new selection adapter public void widget selected selection event e copy files copy checkbox get selection
create the area with the extra options
protected boolean update selection istructured selection selection return super update selection selection selection is of type iresource file
the code open system editor action code implementation of this
protected copy files and folders operation create operation return new copy files and folders operation get shell
returns the operation to perform when this action runs
protected string get errors title return problems title
return the title of the errors dialog
protected list get selected resources list resources super get selected resources if resources is empty resources new array list resources add resources plugin get workspace get root return resources
returns a list containing the workspace root if the selection would
public string is valid object destination iworkspace root root ideworkbench plugin get plugin workspace get root icontainer container icontainer root find member ipath destination if container null create a new operation here is valid is api and may be called in any context copy files and folders operation new operation create operation list sources get selected resources iresource resources iresource sources to array new iresource sources size return new operation validate destination container resources return null
the code copy resource action code implementation of this
protected boolean update selection istructured selection s return super update selection s s is empty get selected non resources size 0
the code refresh action code implementation of this
public void handle key released key event event if event key code swt f5 event state mask 0 refresh all
handle the key release
protected boolean update selection istructured selection selection if super update selection selection return false if get selected non resources size 0 return false to enable this command there must be one project selected and nothing else list selected resources get selected resources if selected resources size 1 return false iresource source iresource selected resources get 0 if source instanceof iproject iproject source is open return true return false
the code copy resource action code implementation of this
public void refresh all istructured selection current selection get structured selection selection changed structured selection empty run selection changed current selection
refreshes the entire workspace
protected boolean ensure source is valid if new file get source directory name is directory return true display error dialog data transfer messages file import invalid source source name field set focus return false
answer a boolean indicating whether the specified source currently exists
public void set model provider ids string model provider ids this model provider ids model provider ids
sets the model provider ids that are known to the client
protected void run operation iresource resources icontainer destination operation copy resources resources destination
runs the operation created in code create operaiton code
private void add all projects iproject project hash set projects if project null project is accessible projects contains project return projects add project try iproject pre reqs project get referenced projects for int i 0 i pre reqs length i add all projects pre reqs i projects catch core exception e ignore inaccessible projects
adds the given project and all of its prerequisities transitively
private void record error core exception error if error status null error status new multi status platform ui plugin id istatus error ideworkbench messages copy project operation copy failed message error error status merge error get status
records the core exception to be displayed to the user
public void run basic new folder resource wizard wizard new basic new folder resource wizard wizard init platform ui get workbench get structured selection wizard set needs progress monitor true wizard dialog dialog new wizard dialog shell wizard dialog create dialog get shell set text ideworkbench messages create folder action title platform ui get workbench get help system set help dialog get shell iidehelp context ids new folder wizard dialog open
the code create folder action code implementation of this
protected boolean update selection istructured selection s if super update selection s return false iterator resources get selected resources iterator while resources has next iresource resource iresource resources next if resource is type resource iresource project iresource folder resource is accessible return false return true
the code create folder action code implementation of this
protected boolean execute import operation import operation op initialize operation op try get container run true true op catch interrupted exception e return false catch invocation target exception e display error dialog e get target exception return false istatus status op get status if status is ok error dialog open error get container get shell data transfer messages file import import problems null no special message status return false return true
execute the passed import operation
protected string get problems message return ideworkbench messages workbench action problems message
returns the string to display for this actions problems dialog
protected void clear cache selection dirty true clear out the lists in case compute resources does not get called immediately resources null non resources null
the code selection listener action code implementation of this
protected list get selected non resources recompute if selection has changed if selection dirty compute resources selection dirty false if non resources null return empty list return non resources
returns the elements in the current selection that are not
protected void internal save widget values update directory names history idialog settings settings get dialog settings if settings null string directory names settings get array store destination names id if directory names null directory names new string 0 directory names add to history directory names get destination value settings put store destination names id directory names options settings put store overwrite existing files id overwrite existing files checkbox get selection settings put store create structure id create directory structure button get selection
hook method for saving widget values for restoration by the next instance
protected boolean update selection istructured selection s projects to build null iproject projects iproject get projects to build to array new iproject 0 return build utilities is enabled projects incremental project builder incremental build
the code build action code implementation of this
protected string get problems title return ideworkbench messages workspace action problems title
returns the title for this actions problems dialog
protected list get selected resources recompute if selection has changed if selection dirty compute resources selection dirty false if resources null return empty list return resources
returns the elements in the current selection that are
protected boolean can perform auto rename return false
returns whether this operation is able to perform on the fly
public boolean finish if ensure source is valid return false save widget values iterator resources enum get selected resources iterator list file system objects new array list while resources enum has next file system objects add file system element resources enum next get file system object if file system objects size 0 return import resources file system objects message dialog open information get container get shell data transfer messages data transfer information data transfer messages file import none selected return false
the finish button was pressed
public void run if save dirty editors return if validate close return be conservative and include all projects in the selection projects can change state between now and when the job starts ischeduling rule rule null iresource rule factory factory resources plugin get workspace get rule factory iterator resources get selected resources iterator while resources has next iproject project iproject resources next rule multi rule combine rule factory modify rule project run in background rule
the implementation of this code workspace action code method
protected boolean resource is type iresource resource int resource mask return resource get type resource mask 0
returns whether the type of the given resource is among those in the
protected string get deep check question iresource source return nls bind ideworkbench messages copy files and folders operation deep move question source get full path make relative
returns the message for querying deep copy move of a linked
protected string get operation title return ideworkbench messages move files and folders operation operation title
returns the task title for this operations progress dialog
protected boolean selection is of type int resource mask if get selected non resources size 0 return false for iterator e get selected resources iterator e has next iresource next iresource e next if resource is type next resource mask return false return true
returns whether the current selection consists entirely of resources
protected string get problems message return ideworkbench messages move files and folders operation problem message
returns the message for this operations problems dialog
protected string get problems title return ideworkbench messages move files and folders operation move failed title
returns the title for this operations problems dialog
protected list get destinations return destinations
returns the destination resources for the resources that have been moved so far
protected boolean get validate conflict source return true
returns whether the source file in a destination collision
protected itree content provider get file provider return new workbench content provider public object get children object o if o instanceof minimized file system element minimized file system element element minimized file system element o return element get files file system structure provider instance get children element return new object 0
returns a content provider for code file system element code s that returns
protected boolean update selection istructured selection s don t call super since we want to enable if open project is selected if selection is of type iresource project return false iterator resources get selected resources iterator while resources has next iproject current resource iproject resources next if current resource is open return true return false
the code close resource action code implementation of this
protected boolean update selection istructured selection selection issue typed selections return super update selection selection selection is empty selection is of type iresource file
the code add bookmark action code implementation of this
protected boolean should perform resource pruning return true
returns whether this action should attempt to optimize the resources being
private boolean can delete iresource resources allow only projects or only non projects to be selected note that the selection may contain multiple types of resource if contains only projects resources contains only non projects resources return false if resources length 0 return false return true if everything in the selection exists for int i 0 i resources length i iresource resource resources i if resource is phantom return false return true
returns whether delete can be performed on the current selection
public void resource changed iresource change event event warning code duplicated in open resource action list sel get selected resources don t bother looking at delta if selection not applicable if selection is of type iresource project iresource delta delta event get delta if delta null iresource delta proj deltas delta get affected children iresource delta changed for int i 0 i proj deltas length i iresource delta proj delta proj deltas i if proj delta get flags iresource delta open 0 if sel contains proj delta get resource selection changed get structured selection return
handles a resource changed event by updating the enablement
protected minimized file system element get file system tree file source directory get source directory if source directory null return null return select files source directory file system structure provider instance
answer the root file system element that represents the contents of
protected boolean update selection istructured selection selection if super update selection selection selection is empty return false for iterator i get selected resources iterator i has next iresource r iresource i next if r is accessible return false return true
the code workspace action code implementation of this
private boolean contains linked resource iresource resources for int i 0 i resources length i iresource resource resources i if resource is linked return true return false
returns whether the selection contains linked resources
private shell get shell return workbench window get shell
returns the shell to use
protected list get action resources return get selected resources
returns the elements that the action is to be performed on
private string get operation message if build type incremental project builder incremental build return ideworkbench messages global build action build operation title return ideworkbench messages global build action rebuild all operation title
returns the operation name to use
protected itree content provider get folder provider return new workbench content provider public object get children object o if o instanceof minimized file system element minimized file system element element minimized file system element o return element get folders file system structure provider instance get children element return new object 0 public boolean has children object o if o instanceof minimized file system element minimized file system element element minimized file system element o if element is populated return get children element length 0 if we have not populated then wait until asked return true return false
returns a content provider for code file system element code s that returns
protected boolean can perform auto rename return true
returns whether this operation is able to perform on the fly
private boolean contains only non projects iresource resources int types get selected resource types resources check for empty selection if types 0 return false note that the selection may contain multiple types of resource return types iresource project 0
returns whether the selection contains only non projects
public void do build do build operation
builds all projects within the workspace
private int count closed projects int count 0 iproject projects resources plugin get workspace get root get projects for int i 0 i projects length i if projects i is open count return count
returns the total number of closed projects in the workspace
public void run in background ischeduling rule rule run in background rule object null
run the action in the background rather than with the
private boolean contains only projects iresource resources int types get selected resource types resources note that the selection may contain multiple types of resource return types iresource project
returns whether the selection contains only projects
public void run in background ischeduling rule rule object job family if job family null run in background rule object null else run in background rule new object job family
run the action in the background rather than with the
private void add working set build actions menu manager menu build working set menu new menu manager ideworkbench messages workbench build set icontribution item working set builds new build set menu window get action bar configurer build working set menu add working set builds menu add build working set menu
adds the keyboard navigation submenu to the specified menu
private boolean has other closed projects count the closed projects in the selection int closed in selection 0 iterator resources get selected resources iterator while resources has next iproject project iproject resources next if project is open closed in selection there are other closed projects if the selection does not contain all closed projects in the workspace return closed in selection count closed projects
returns whether there are closed projects in the workspace that are
protected string get deep check question iresource source return nls bind ideworkbench messages copy files and folders operation deep copy question source get full path make relative
returns the message for querying deep copy move of a linked resource
private boolean check read only and null iresource current resource do a quick read only and null check if current resource null return false do a quick read only check if current resource get resource attributes is read only return message dialog open question get shell check rename title message format format check rename message new object current resource get name return true
check if the supplied resource is read only or null
public void resource changed iresource change event event warning code duplicated in close resource action list sel get selected resources don t bother looking at delta if selection not applicable if selection is of type iresource project iresource delta delta event get delta if delta null iresource delta proj deltas delta get affected children iresource delta changed for int i 0 i proj deltas length i iresource delta proj delta proj deltas i if proj delta get flags iresource delta open 0 if sel contains proj delta get resource selection changed get structured selection return
handles a resource changed event by updating the enablement if one of the
private boolean verify no manual running job build jobs platform get job manager find resources plugin family manual build if build jobs length 0 return true boolean cancel message dialog open question workbench window get shell ideworkbench messages global build action build running title ideworkbench messages global build action build running message if cancel for int i 0 i build jobs length i job job build jobs i job cancel if they cancelled get them to do it again return false
verify that no manual build is running
protected file get source directory return get source directory this source name field get text
returns a file object representing the currently named source directory iff
private void do open with references iproject project iprogress monitor monitor throws core exception if project exists project is open return project open new sub progress monitor monitor 1000 iproject references project get referenced projects for int i 0 i references length i do open with references references i monitor
opens a project along with all projects it references
private boolean confirm delete iresource resources if validate delete resources if contains only projects resources return confirm delete projects resources return confirm delete non projects resources return false
asks the user to confirm a delete operation
protected boolean update selection istructured selection s don t call super since we want to enable if closed project is selected if selection is of type iresource project return false iterator resources get selected resources iterator while resources has next iproject current resource iproject resources next if current resource is open return true return false
the code open resource action code implementation of this
protected boolean update selection istructured selection s return super update selection s get selected non resources size 0
the code scrub local action code implementation of this
private file get source directory string path file source directory new file get source directory name path if source directory exists source directory is directory return null return source directory
returns a file object representing the currently named source directory iff
private image get image ieditor descriptor editor desc image descriptor image desc get image descriptor editor desc if image desc null return null image image image image cache get image desc if image null image image desc create image image cache put image desc image return image
returns an image to show for the corresponding editor descriptor
private image descriptor get image descriptor ieditor descriptor editor desc image descriptor image desc null if editor desc null image desc registry get image descriptor get file resource get name todo is this case valid and if so what are the implications for content type editor bindings else image desc editor desc get image descriptor if image desc null if editor desc get id equals ieditor registry system external editor id image desc registry get system external editor image descriptor get file resource get name return image desc
returns the image descriptor for the given editor descriptor
private boolean should check iresource resource to check if ignore linked resources if resource to check is linked return false return true
returns whether the given resource should be checked for read only state
private boolean confirm delete projects iresource resources delete project dialog dialog new delete project dialog shell resources dialog set testing mode f testing mode int code dialog open delete content dialog get delete content return code 0 yes
asks the user to confirm a delete operation where the selection contains
private ifile get file resource if this file instanceof ifile return ifile this file iresource resource iresource this file get adapter iresource class if resource instanceof ifile return ifile resource return null
converts the iadaptable file to ifile or null
private string get source directory name return get source directory name this source name field get text
answer the directory name specified as being the import source
public boolean get ignore linked resources return ignore linked resources
returns whether to ignore linked resources
private void open editor ieditor descriptor editor ifile file get file resource if file null return try string editor id editor null ieditor registry system external editor id editor get id workbench page page open editor new file editor input file editor id true match both only remember the default editor if the open succeeds ide set default editor file editor id catch part init exception e dialog util open error page get workbench window get shell ideworkbench messages open with menu dialog title e get message e
opens the given editor on the selected file
public void set ignore linked resources boolean ignore ignore linked resources ignore
sets whether to ignore linked resources
public void update enabled state if active text control null active text control is disposed set enabled active text control get selection count 0 return if copy action null set enabled copy action is enabled return set enabled false
update the state
private void dispose text widget if text action handler null text action handler remove text text editor if text editor parent null text editor parent dispose text editor parent null text editor null tree editor set editor null null
close the text widget and reset the editor text field
private string get source directory name string source name ipath result new path source name trim if result get device null result segment count 0 result result add trailing separator else result result remove trailing separator return result to osstring
answer the directory name specified as being the import source