Java Code Examples for org.eclipse.jface.window.Window

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project droolsjbpm-tools, under directory /drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/rulebuilder/ui/.

Source file: RuleModeller.java

  21 
vote

public RuleModeller(ScrolledForm form,FormToolkit toolkit,RuleModel model,RuleEditor editor){
  this.form=form;
  this.toolkit=toolkit;
  this.model=model;
  this.editor=editor;
  setTitleAndFont(form);
  ColumnLayout colLayout=new ColumnLayout();
  colLayout.minNumColumns=1;
  colLayout.maxNumColumns=1;
  form.getBody().setLayout(colLayout);
  Shell shell=new Shell(Display.getCurrent());
  Window conditionPopup=new AddNewConditionDialog(shell,this);
  Window actionPopup=new AddNewActionDialog(shell,this);
  Window optionsPopup=new RuleAttributesDialog(shell,this);
  Section ifSection=createMainSection(form,toolkit,"WHEN",conditionPopup);
  Section thenSection=createMainSection(form,toolkit,"THEN",actionPopup);
  Section optionsSection=createMainSection(form,toolkit,"(options)",optionsPopup);
  ColumnLayout layout=new ColumnLayout();
  layout.minNumColumns=1;
  layout.maxNumColumns=1;
  ((Composite)(ifSection.getClient())).setLayout(layout);
  ((Composite)(thenSection.getClient())).setLayout(layout);
  ((Composite)(optionsSection.getClient())).setLayout(layout);
  ifSection.setLayout(layout);
  thenSection.setLayout(layout);
  optionsSection.setLayout(layout);
  ifComposite=(Composite)ifSection.getClient();
  thenComposite=(Composite)thenSection.getClient();
  optionsComposite=(Composite)optionsSection.getClient();
}
 

Example 2

From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.datatools.enablement.simpledb.editor.ui/src/com/amazonaws/eclipse/datatools/enablement/simpledb/editor/wizard/.

Source file: SDBTableDataWizardPage.java

  19 
vote

private String getNewValue(final String value){
  InputDialog id=new InputDialog(this.editor.getEditorSite().getShell(),Messages.dialogTitle,Messages.dialogDescription,value,new IInputValidator(){
    public String isValid(    final String s){
      if (s.getBytes().length > 1024) {
        return Messages.valueToLong;
      }
      return null;
    }
  }
);
  if (id.open() == Window.OK) {
    return id.getValue();
  }
 else {
    return null;
  }
}
 

Example 3

From project bel-editor, under directory /org.openbel.editor.ui/src/org/openbel/editor/ui/actions/.

Source file: DocumentGroupDelegate.java

  19 
vote

/** 
 * {@inheritDoc}
 */
@Override public void run(IAction action){
  Shell shell=getCurrent().getActiveShell();
  InputDialog i=new InputDialog(shell,DIALOG_TITLE,DIALOG_PROMPT,"",new IInputValidator(){
    @Override public String isValid(    String newGrp){
      return validateDocumentGroup(newGrp);
    }
  }
);
  i.open();
  if (i.getReturnCode() == Window.OK) {
    String userInput=i.getValue();
    List<String> projects=getDefault().getSelectedProjects();
    for (    final String project : projects) {
      IWorkspaceRoot r=getWorkspace().getRoot();
      IProject p=r.getProject(project);
      IFolder f=p.getFolder(userInput);
      try {
        f.create(false,true,new NullProgressMonitor());
      }
 catch (      CoreException e) {
        logError(e);
      }
    }
  }
}
 

Example 4

From project BHT-FPA, under directory /mailer-common/de.bht.fpa.mail.common/src/de/bht/fpa/mail/s000000/common/swt/.

Source file: DirectoryDialog.java

  19 
vote

private String openInputDialog(){
  InputDialog inputDialog=new InputDialog(parent,text,message,"",null);
  if (inputDialog.open() != Window.OK) {
    return null;
  }
  return inputDialog.getValue();
}
 

Example 5

From project bndtools, under directory /bndtools.core/src/bndtools/editor/contents/.

Source file: PrivatePackagesPart.java

  19 
vote

private void doAddPackages(){
  final Set<String> packageNameSet=new HashSet<String>(packages);
  IPackageFilter filter=new IPackageFilter(){
    public boolean select(    String packageName){
      return !packageName.equals("java") && !packageName.startsWith("java.") && !packageNameSet.contains(packageName);
    }
  }
;
  IFormPage page=(IFormPage)getManagedForm().getContainer();
  IWorkbenchWindow window=page.getEditorSite().getWorkbenchWindow();
  IJavaProject javaProject=getJavaProject();
  if (javaProject == null) {
    MessageDialog.openError(getSection().getShell(),"Error","Cannot add packages: unable to find a Java project associated with the editor input.");
    return;
  }
  IJavaSearchScope searchScope=SearchEngine.createJavaSearchScope(new IJavaElement[]{javaProject});
  JavaSearchScopePackageLister packageLister=new JavaSearchScopePackageLister(searchScope,window);
  PackageSelectionDialog dialog=new PackageSelectionDialog(getSection().getShell(),packageLister,filter,"Select new packages to include in the bundle.");
  dialog.setSourceOnly(true);
  dialog.setMultipleSelection(true);
  if (dialog.open() == Window.OK) {
    Object[] results=dialog.getResult();
    List<String> added=new LinkedList<String>();
    for (    Object result : results) {
      String newPackageName=(String)result;
      if (packages.add(newPackageName)) {
        added.add(newPackageName);
      }
    }
    if (!added.isEmpty()) {
      viewer.add(added.toArray(new String[added.size()]));
      markDirty();
    }
  }
}
 

Example 6

From project bpelunit, under directory /tycho/net.bpelunit.framework.client.eclipse/src/net/bpelunit/framework/client/eclipse/dialog/field/.

Source file: FileSelector.java

  19 
vote

private static IFile selectFile(Shell shell,String title,String message,ViewerFilter filter,IContainer rootElement,IFile selectedFile){
  ISelectionStatusValidator validator=new ISelectionStatusValidator(){
    public IStatus validate(    Object[] selection){
      if (selection.length == 0) {
        return new Status(IStatus.ERROR,BPELUnitActivator.getUniqueIdentifier(),0,"",null);
      }
      for (      Object element : selection) {
        if (!(element instanceof IFile)) {
          return new Status(IStatus.ERROR,BPELUnitActivator.getUniqueIdentifier(),0,"",null);
        }
      }
      return new Status(IStatus.OK,BPELUnitActivator.getUniqueIdentifier(),0,"",null);
    }
  }
;
  ILabelProvider lp=new WorkbenchLabelProvider();
  ITreeContentProvider cp=new WorkbenchContentProvider();
  ElementTreeSelectionDialog dialog=new ElementTreeSelectionDialog(shell,lp,cp);
  dialog.setValidator(validator);
  dialog.setTitle(title);
  dialog.setMessage(message);
  dialog.addFilter(filter);
  dialog.setInput(rootElement);
  if (selectedFile != null)   dialog.setInitialSelection(selectedFile);
  dialog.setSorter(new ResourceSorter(ResourceSorter.NAME));
  if (dialog.open() == Window.OK) {
    return (IFile)dialog.getFirstResult();
  }
  return null;
}
 

Example 7

From project BPMN2-Editor-for-Eclipse, under directory /org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/.

Source file: BPMN2DiagramWizardPage.java

  19 
vote

/** 
 * Uses the standard diagramContainer selection dialog to choose the new value for the diagramContainer field.
 */
private void handleBrowse(){
  ContainerSelectionDialog dialog=new ContainerSelectionDialog(getShell(),ResourcesPlugin.getWorkspace().getRoot(),false,"Select Folder for the diagram");
  if (dialog.open() == Window.OK) {
    Object[] result=dialog.getResult();
    if (result.length == 1) {
      containerText.setText(((Path)result[0]).toString());
    }
  }
}
 

Example 8

From project bundlemaker, under directory /main/org.bundlemaker.core.ui/src/org/bundlemaker/core/ui/handler/.

Source file: CreateNewGroupHandler.java

  19 
vote

/** 
 * Prompts the user for the name of a (new) group
 * @param shell
 * @param parentContainer the container the (new) group belongs to
 * @param preset the preset that is displayed to the user
 * @return the entered name or null if the user has canceled the dialog
 */
public static String getGroupName(Shell shell,IGroupAndModuleContainer parentContainer,String preset,boolean newGroup){
  Set<String> existingArtifactNames=getExistingArtifactNames(parentContainer);
  existingArtifactNames.remove(preset);
  GroupNameValidator groupNameValidator=new GroupNameValidator(existingArtifactNames);
  InputDialog dlg=new InputDialog(shell,(newGroup ? "Create new Group" : "Rename Group"),(newGroup ? "Please enter the name of new Group" : "Please enter new name for Group " + preset),preset,groupNameValidator);
  if (dlg.open() != Window.OK) {
    return null;
  }
  return dlg.getValue();
}
 

Example 9

From project ccw, under directory /ccw.core/src/java/ccw/launching/.

Source file: ClojureLaunchShortcut.java

  19 
vote

protected ILaunchConfiguration chooseConfiguration(List configList){
  IDebugModelPresentation labelProvider=null;
  try {
    labelProvider=DebugUITools.newDebugModelPresentation();
    ElementListSelectionDialog dialog=new ElementListSelectionDialog(JDIDebugUIPlugin.getActiveWorkbenchShell(),labelProvider);
    dialog.setElements(configList.toArray());
    dialog.setTitle("Choose a Clojure launch configuration");
    dialog.setMessage(LauncherMessages.JavaLaunchShortcut_2);
    dialog.setMultipleSelection(false);
    int result=dialog.open();
    if (result == Window.OK) {
      return (ILaunchConfiguration)dialog.getFirstResult();
    }
    return null;
  }
  finally {
    if (labelProvider != null) {
      labelProvider.dispose();
    }
  }
}
 

Example 10

From project ceylon-ide-eclipse, under directory /plugins/com.redhat.ceylon.eclipse.ui/src/com/redhat/ceylon/eclipse/code/imports/.

Source file: CleanImportsHandler.java

  19 
vote

public Declaration select(List<Declaration> proposals){
  CeylonEditor editor=(CeylonEditor)getCurrentEditor();
  ImportSelectionDialog fid=new ImportSelectionDialog(editor.getSite().getShell(),proposals);
  if (fid.open() == Window.OK) {
    return (Declaration)fid.getFirstResult();
  }
  return null;
}
 

Example 11

From project cilia-workbench, under directory /cilia-workbench-designer/src/fr/liglab/adele/cilia/workbench/designer/view/chainview/abstractchain/.

Source file: AbstractChainConfiguration.java

  19 
vote

public Object createAdapterHandler(ExecutionEvent event) throws ExecutionException {
  if (model != null) {
    NewAdapterDialog window=new NewAdapterDialog(ViewUtil.getShell(event),model);
    if (window.open() == Window.OK) {
      String id=window.getText();
      IGenericAdapter adapter=(IGenericAdapter)window.getValue();
      try {
        AbstractCompositionsRepoService.getInstance().createAdapter(model,id,adapter);
      }
 catch (      CiliaException e) {
        e.printStackTrace();
      }
    }
  }
  return null;
}
 

Example 12

From project Database-Designer, under directory /plugins/org.obeonetwork.dsl.entityrelation.edit/src-gen/org/obeonetwork/dsl/entityrelation/parts/forms/.

Source file: AttributePropertiesEditionPartForm.java

  19 
vote

/** 
 */
protected Composite createLiteralsMultiValuedEditor(FormToolkit widgetFactory,Composite parent){
  literals=widgetFactory.createText(parent,"",SWT.READ_ONLY);
  GridData literalsData=new GridData(GridData.FILL_HORIZONTAL);
  literalsData.horizontalSpan=2;
  literals.setLayoutData(literalsData);
  EditingUtils.setID(literals,EntityrelationViewsRepository.Attribute.Properties.literals);
  EditingUtils.setEEFtype(literals,"eef::MultiValuedEditor::field");
  editLiterals=widgetFactory.createButton(parent,getDescription(EntityrelationViewsRepository.Attribute.Properties.literals,EntityrelationMessages.AttributePropertiesEditionPart_LiteralsLabel),SWT.NONE);
  GridData editLiteralsData=new GridData();
  editLiterals.setLayoutData(editLiteralsData);
  editLiterals.addSelectionListener(new SelectionAdapter(){
    /** 
 * {@inheritDoc}
 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
 */
    public void widgetSelected(    SelectionEvent e){
      EEFFeatureEditorDialog dialog=new EEFFeatureEditorDialog(literals.getShell(),"Attribute",new AdapterFactoryLabelProvider(adapterFactory),literalsList,TypesLibraryPackage.eINSTANCE.getTypeInstance_Literals().getEType(),null,false,true,null,null);
      if (dialog.open() == Window.OK) {
        literalsList=dialog.getResult();
        if (literalsList == null) {
          literalsList=new BasicEList();
        }
        literals.setText(literalsList.toString());
        propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(AttributePropertiesEditionPartForm.this,EntityrelationViewsRepository.Attribute.Properties.literals,PropertiesEditionEvent.COMMIT,PropertiesEditionEvent.SET,null,new BasicEList(literalsList)));
        setHasChanged(true);
      }
    }
  }
);
  EditingUtils.setID(editLiterals,EntityrelationViewsRepository.Attribute.Properties.literals);
  EditingUtils.setEEFtype(editLiterals,"eef::MultiValuedEditor::browsebutton");
  return parent;
}
 

Example 13

From project dawn-isenciaui, under directory /com.teaminabox.eclipse.wiki/src/com/teaminabox/eclipse/wiki/export/.

Source file: WikiExportWizardPage.java

  19 
vote

private void handleBrowseFolders() throws CoreException {
  ContainerSelectionDialog dialog=new ContainerSelectionDialog(getShell(),ResourcesPlugin.getWorkspace().getRoot(),false,WikiPlugin.getResourceString("Export.wizardSelectFolder"));
  if (dialog.open() == Window.OK) {
    Object[] result=dialog.getResult();
    if (result != null && result.length == 1) {
      IResource resource=ResourcesPlugin.getWorkspace().getRoot().findMember((IPath)result[0]);
      if (resource.getType() == IResource.FILE) {
        return;
      }
      initialiseFolder(resource);
    }
  }
}
 

Example 14

From project dawn-ui, under directory /org.dawb.workbench.plotting/src/org/dawb/workbench/plotting/system/.

Source file: LightWeightActionBarsManager.java

  19 
vote

protected void createAnnotationActions(){
  addToolbarSeparator("org.csstudio.swt.xygraph.toolbar.annotation");
  final Action addAnnotation=new Action("Add Annotation...",Activator.getImageDescriptor("icons/Add_Annotation.png")){
    public void run(){
      final XYRegionGraph xyGraph=system.getGraph();
      AddAnnotationDialog dialog=new AddAnnotationDialog(Display.getCurrent().getActiveShell(),xyGraph);
      if (dialog.open() == Window.OK) {
        xyGraph.addAnnotation(dialog.getAnnotation());
        xyGraph.getOperationsManager().addCommand(new AddAnnotationCommand(xyGraph,dialog.getAnnotation()));
      }
    }
  }
;
  if (system.getActionBars() != null)   system.getActionBars().getToolBarManager().add(addAnnotation);
  final Action delAnnotation=new Action("Remove Annotation...",Activator.getImageDescriptor("icons/Del_Annotation.png")){
    public void run(){
      final XYRegionGraph xyGraph=system.getGraph();
      RemoveAnnotationDialog dialog=new RemoveAnnotationDialog(Display.getCurrent().getActiveShell(),xyGraph);
      if (dialog.open() == Window.OK && dialog.getAnnotation() != null) {
        xyGraph.removeAnnotation(dialog.getAnnotation());
        xyGraph.getOperationsManager().addCommand(new RemoveAnnotationCommand(xyGraph,dialog.getAnnotation()));
      }
    }
  }
;
  if (system.getActionBars() != null)   system.getActionBars().getToolBarManager().add(delAnnotation);
  addToolbarSeparator("org.csstudio.swt.xygraph.toolbar.extra");
}
 

Example 15

From project dozer, under directory /eclipse-plugin/net.sf.dozer.eclipse.plugin/src/org/dozer/eclipse/plugin/editorpage/utils/.

Source file: DozerUiUtils.java

  19 
vote

public String doOpenClassSelectionDialog(String superType,boolean allowInterfaces){
  IJavaSearchScope searchScope=null;
  IProject project=getProject();
  try {
    IJavaProject javaProject=JavaCore.create(project);
    if (superType != null) {
      IType superTypeType=javaProject.findType(superType);
      if (superTypeType != null) {
        searchScope=SearchEngine.createHierarchyScope(superTypeType);
      }
 else       return null;
    }
    SelectionDialog dialog=JavaUI.createTypeDialog(DozerPlugin.getActiveWorkbenchShell(),PlatformUI.getWorkbench().getProgressService(),searchScope,allowInterfaces ? IJavaElementSearchConstants.CONSIDER_CLASSES_AND_INTERFACES : IJavaElementSearchConstants.CONSIDER_CLASSES,false);
    dialog.setTitle("Browse...");
    if (dialog.open() == Window.OK) {
      IType type=(IType)dialog.getResult()[0];
      return type.getFullyQualifiedName('$');
    }
  }
 catch (  Exception e) {
    Logger.logException(e);
  }
  return null;
}
 

Example 16

From project e4-rendering, under directory /com.toedter.e4.demo.contacts.swt/src/com/toedter/e4/demo/contacts/swt/views/.

Source file: DetailsView.java

  19 
vote

@Inject public void setSelection(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) Contact contact){
  if (contact != null) {
    if (dirtyable.isDirty()) {
      MessageDialog dialog=new MessageDialog(detailComposite.getShell(),"Save vCard",null,"The current vCard has been modified. Save changes?",MessageDialog.CONFIRM,new String[]{IDialogConstants.YES_LABEL,IDialogConstants.NO_LABEL},0);
      dialog.create();
      ThemeUtil.applyDialogStyles(engine,dialog.getShell());
      if (dialog.open() == Window.OK) {
        ParameterizedCommand saveCommand=commandService.createCommand("contacts.save",Collections.EMPTY_MAP);
        handlerService.executeHandler(saveCommand);
      }
    }
    updatePartTitle(contact);
  }
 else {
    uiItem.setLabel("Details");
  }
  dirtyable.setDirty(false);
  detailComposite.update(contact);
}
 

Example 17

From project Eclipse, under directory /com.mobilesorcery.sdk.ui/src/com/mobilesorcery/sdk/ui/.

Source file: MoSyncProjectSelectionDialog.java

  19 
vote

/** 
 * Opens the dialog and returns the selected project, or <code>null</code> if cancelled.
 * @return
 */
public IProject selectProject(){
  try {
    setElements(getMoSyncProjects(ResourcesPlugin.getWorkspace().getRoot()));
  }
 catch (  CoreException e) {
    CoreMoSyncPlugin.getDefault().log(e);
  }
  if (open() == Window.OK) {
    return (IProject)getFirstResult();
  }
  return null;
}
 

Example 18

From project eclipse-instasearch, under directory /instasearch/src/it/unibz/instasearch/prefs/.

Source file: InstaSearchPreferencePage.java

  19 
vote

@Override protected String getNewInputObject(){
  FilteredResourcesPatternDialog dlg=new FilteredResourcesPatternDialog(getShell());
  dlg.setTitle("Exclude folders");
  dlg.setMessage("Exclude folders matching pattern (? = any character, * = any string, ** = any subfolder)");
  dlg.setInitialPattern("**/bin");
  dlg.setHelpAvailable(false);
  dlg.open();
  if (dlg.getReturnCode() == Window.OK)   return dlg.getLastPattern();
  return null;
}
 

Example 19

From project eclipse-integration-cloudfoundry, under directory /org.cloudfoundry.ide.eclipse.server.ui/src/org/cloudfoundry/ide/eclipse/internal/server/ui/actions/.

Source file: CaldecottUIHelper.java

  19 
vote

public void openCaldecottTunnelWizard(){
  UIJob uiJob=new UIJob("Show Tunnels"){
    public IStatus runInUIThread(    IProgressMonitor monitor){
      Shell shell=getShell();
      CaldecottTunnelWizard wizard=new CaldecottTunnelWizard(cloudServer);
      WizardDialog dialog=new WizardDialog(shell,wizard);
      if (dialog.open() == Window.OK) {
        Set<CaldecottTunnelDescriptor> descriptorsToRemove=wizard.getDescriptorsToRemove();
        if (descriptorsToRemove != null) {
          for (          CaldecottTunnelDescriptor descriptor : descriptorsToRemove) {
            try {
              new CaldecottTunnelHandler(cloudServer).stopAndDeleteCaldecottTunnel(descriptor.getServiceName(),monitor);
            }
 catch (            CoreException e) {
              CloudFoundryPlugin.logError(e);
            }
          }
        }
      }
      return Status.OK_STATUS;
    }
  }
;
  uiJob.schedule();
}
 

Example 20

From project eclipse-integration-commons, under directory /org.springsource.ide.eclipse.commons.frameworks.ui/src/org/springsource/ide/eclipse/commons/frameworks/ui/internal/contentassist/.

Source file: JavaContentAssistUIAdapter.java

  19 
vote

public void browseButtonPressed(){
  IPackageFragment[] projectFragments=getPackageFragments();
  if (projectFragments == null) {
    return;
  }
  Shell shell=getHandler().getShell();
  ElementListSelectionDialog dialog=new ElementListSelectionDialog(shell,new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT));
  dialog.setIgnoreCase(false);
  dialog.setTitle(getJavaParameterDescriptor().getName());
  dialog.setMessage("Select a source package");
  dialog.setEmptyListMessage("No source packages to select in given project");
  dialog.setElements(projectFragments);
  dialog.setHelpAvailable(false);
  if (dialog.open() == Window.OK) {
    String dialogValue=((IPackageFragment)dialog.getFirstResult()).getElementName();
    setValue(dialogValue);
  }
}
 

Example 21

From project eclipse-integration-gradle, under directory /org.springsource.ide.eclipse.gradle.ui/src/org/springsource/ide/eclipse/gradle/ui/launch/.

Source file: GradleLaunchShortcut.java

  19 
vote

/** 
 * If more than one configuration is found for a given "launch" request
 */
protected ILaunchConfiguration chooseConfiguration(GradleProject project,ILaunchConfiguration[] confs){
  IDebugModelPresentation labelProvider=DebugUITools.newDebugModelPresentation();
  ElementListSelectionDialog dialog=new ElementListSelectionDialog(getShell(),labelProvider);
  dialog.setElements(confs);
  dialog.setTitle("Choose a Gradle Launch Configuration");
  dialog.setMessage("Multiple configurations were found for project " + project.getName());
  dialog.setMultipleSelection(false);
  int result=dialog.open();
  labelProvider.dispose();
  if (result == Window.OK) {
    return (ILaunchConfiguration)dialog.getFirstResult();
  }
  return null;
}
 

Example 22

From project eclipsefp, under directory /net.sf.eclipsefp.haskell.debug.ui/INTERNAL/java/src/net/sf/eclipsefp/haskell/debug/ui/internal/launch/.

Source file: LaunchOperation.java

  19 
vote

ILaunchConfiguration choose(final List<ILaunchConfiguration> configs){
  IDebugModelPresentation pres=DebugUITools.newDebugModelPresentation();
  Shell shell=getActiveShell();
  ElementListSelectionDialog dialog=new ElementListSelectionDialog(shell,pres);
  dialog.setElements(configs.toArray());
  dialog.setTitle(UITexts.launchOperation_title);
  dialog.setMessage(UITexts.launchOperation_msg);
  dialog.setMultipleSelection(false);
  ILaunchConfiguration result=null;
  int returnVal=dialog.open();
  pres.dispose();
  if (returnVal == Window.OK) {
    result=(ILaunchConfiguration)dialog.getFirstResult();
  }
  return result;
}
 

Example 23

From project egit-github, under directory /org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/.

Source file: CreateGistHandler.java

  19 
vote

private void createGistJob(ExecutionEvent event,String name,String contents,boolean isPublic){
  Set<TaskRepository> repositories=GistConnectorUi.getRepositories();
  if (repositories.isEmpty())   return;
  TaskRepository repository=null;
  if (repositories.size() > 1) {
    GistConnectorSelectionDialog dialog=new GistConnectorSelectionDialog(HandlerUtil.getActiveShell(event),repositories);
    if (Window.OK == dialog.open())     repository=(TaskRepository)dialog.getResult()[0];
  }
 else   repository=repositories.iterator().next();
  if (repository == null)   return;
  GitHubClient client=GistConnector.createClient(repository);
  GistService service=new GistService(client);
  CreateGistJob job=new CreateGistJob(Messages.CreateGistHandler_CreateGistJobName,name,contents,service,isPublic,repository);
  job.schedule();
}
 

Example 24

From project gda-common-rcp, under directory /uk.ac.gda.common.rcp/src/uk/ac/gda/richbeans/components/scalebox/.

Source file: RangeBox.java

  19 
vote

/** 
 * Create the composite RangeBox for use in GDA UI. After creating the composite set the scale properties (max, min etc.). These are used at run time by a lazy initiated form.
 * @param parent
 * @param style
 */
public RangeBox(final Composite parent,final int style){
  super(parent,style);
  this.buttonSelection=new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      dialog=new RangeDialog(getShell(),isIntegerBox());
      dialog.setRangeOnly(isRangeOnly());
      dialog.create();
      if (getDialogTitle() != null)       dialog.getShell().setText(getDialogTitle());
      dialog.setUnit(getUnit());
      dialog.setValue(getValue());
      dialog.setBounds(RangeBox.this);
      if (dialog.open() == Window.OK) {
        checkValue(dialog.getValue());
      }
      dialog=null;
    }
  }
;
  setButtonVisible(true);
  this.button.setToolTipText("Open range form which allows this value to be defined as a range.");
  this.button.setImage(SWTResourceManager.getImage(RangeBox.class,"/icons/arrow_divide.png"));
  this.button.setText("");
  final GridData bLayout=(GridData)button.getLayoutData();
  bLayout.widthHint=29;
}
 

Example 25

From project gmc, under directory /src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/dialogs/.

Source file: CreateVolumePage1.java

  19 
vote

private void createDisksCustomizeLink(Composite container){
  linkCustomize=new Link(container,SWT.UNDERLINE_LINK);
  linkCustomize.setText("All Brick(s) (<a>customize</a>)");
  linkCustomize.setEnabled(false);
  linkCustomize.addListener(SWT.Selection,new Listener(){
    public void handleEvent(    Event event){
      Display.getDefault().asyncExec(new Runnable(){
        @Override public void run(){
          SelectDisksDialog dialog=new SelectDisksDialog(getShell(),allDevices,selectedDevices,txtName.getText().trim());
          dialog.create();
          if (dialog.open() == Window.OK) {
            selectedDevices=dialog.getSelectedDevices();
            linkCustomize.setText("" + selectedDevices.size() + " Brick(s) (<a>customize</a>)");
            validateForm();
          }
        }
      }
);
    }
  }
);
}
 

Example 26

From project grails-ide, under directory /org.grails.ide.eclipse.editor.groovy/src/org/grails/ide/eclipse/editor/actions/.

Source file: AbstractGotoClass.java

  19 
vote

/** 
 * Sub classes override to open a new element wizard for this artifact
 * @param elt
 * @return
 */
protected boolean openNewElementWizard(INavigableGrailsElement elt){
  if (getCommandName() == null) {
    return false;
  }
  ICompilationUnit unit=((IGrailsElement)elt).getCompilationUnit();
  GrailsCommandWizard wizard=new GrailsCommandWizard(Collections.singleton(unit.getJavaProject().getProject()),getCommand(elt.getAssociatedDomainClassName()));
  WizardDialog dialog=new WizardDialog(editor.getEditorSite().getShell(),wizard);
  return dialog.open() == Window.OK;
}
 

Example 27

From project gted, under directory /net.sf.gted.tools/src/net/sf/gted/tools/properties/.

Source file: FolderSelectionDialog.java

  19 
vote

/** 
 */
protected void newFolderButtonPressed(){
  final NewFolderDialog dialog=new NewFolderDialog(this.getShell(),this.fSelectedContainer);
  if (dialog.open() == Window.OK) {
    final TreeViewer treeViewer=this.getTreeViewer();
    treeViewer.refresh(this.fSelectedContainer);
    Object createdFolder;
    if (dialog.getResult() != null) {
      createdFolder=dialog.getResult()[0];
      treeViewer.reveal(createdFolder);
      treeViewer.setSelection(new StructuredSelection(createdFolder));
    }
  }
}
 

Example 28

From project hackergarten-moreunit, under directory /org.moreunit.core.test/test/org/moreunit/core/commands/.

Source file: JumpActionHandlerTest.java

  19 
vote

@Test public void should_undo_folder_creation_when_file_creation_is_aborted() throws Exception {
  preferences.writerForAnyLanguage().setTestFolderPathTemplate("${srcProject}/src/folder/with/several/parts","${srcProject}/test/folder/having/many/parts");
  IFile sourceFile=createFile("src/folder/with/several/parts/SomeConcept.thing");
  createFolder("test/folder/having");
  openEditor(sourceFile);
  Config.wizardDriver=new WizardDriver(){
    public int open(    DrivableWizardDialog dialog){
      assertTrue(getFolder("test/folder/having/many/parts").exists());
      return Window.CANCEL;
    }
  }
;
  executeCommand(JUMP_COMMAND);
  assertTrue(getFolder("test/folder/having").exists());
  assertFalse(getFolder("test/folder/having/many/parts").exists());
}
 

Example 29

From project ivyde, under directory /org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/.

Source file: IvyDEProjectPreferences.java

  19 
vote

private void openEdit(IStructuredSelection selection,IProject project){
  StandaloneRetrieveSetup setup=(StandaloneRetrieveSetup)selection.getFirstElement();
  EditStandaloneRetrieveDialog editDialog=new EditStandaloneRetrieveDialog(getShell(),project,setup);
  if (editDialog.open() == Window.OK) {
    List list=((List)table.getInput());
    list.set(list.indexOf(setup),editDialog.getStandaloneRetrieveSetup());
    table.refresh();
  }
}
 

Example 30

From project JGit, under directory /org.spearce.egit.ui/src/org/spearce/egit/ui/internal/preferences/.

Source file: GitDecoratorPreferencePage.java

  19 
vote

/** 
 * Adds another variable to the given target text A ListSelectionDialog pops up and allow the user to choose the variable, which is then inserted at current position in <code>text</code>
 * @param target the target to add the variable to
 * @param bindings the map of bindings
 */
private void addVariables(Text target,Map bindings){
  final List<StringPair> variables=new ArrayList<StringPair>(bindings.size());
  ILabelProvider labelProvider=new LabelProvider(){
    public String getText(    Object element){
      return ((StringPair)element).s1 + " - " + ((StringPair)element).s2;
    }
  }
;
  IStructuredContentProvider contentsProvider=new IStructuredContentProvider(){
    public Object[] getElements(    Object inputElement){
      return variables.toArray(new StringPair[variables.size()]);
    }
    public void dispose(){
    }
    public void inputChanged(    Viewer viewer,    Object oldInput,    Object newInput){
    }
  }
;
  for (Iterator it=bindings.keySet().iterator(); it.hasNext(); ) {
    StringPair variable=new StringPair();
    variable.s1=(String)it.next();
    variable.s2=(String)bindings.get(variable.s1);
    variables.add(variable);
  }
  ListSelectionDialog dialog=new ListSelectionDialog(this.getShell(),this,contentsProvider,labelProvider,UIText.DecoratorPreferencesPage_selectVariablesToAdd);
  dialog.setTitle(UIText.DecoratorPreferencesPage_addVariablesTitle);
  if (dialog.open() != Window.OK)   return;
  Object[] result=dialog.getResult();
  for (int i=0; i < result.length; i++) {
    target.insert("{" + ((StringPair)result[i]).s1 + "}");
  }
}
 

Example 31

From project js4emf, under directory /org.eclipse.emf.js4emf.ui/src/org/eclipse/emf/js4emf/ui/.

Source file: DelegatesScriptView.java

  19 
vote

@Override public void run(){
  if (isEnabled()) {
    InputDialog dialog=createInputDialog(display.getActiveShell());
    if (dialog.open() == Window.OK) {
      runWithInput((EClass)getSelectedEObject(),dialog.getValue());
      updateView();
    }
  }
}
 

Example 32

From project koneki.ldt, under directory /plugins/org.eclipse.koneki.ldt.debug.ui/src/org/eclipse/koneki/ldt/debug/ui/internal/launchconfiguration/local/tab/.

Source file: LuaEnvironmentTab.java

  19 
vote

@Override protected void handleEnvAddButtonSelected(){
  final MultipleInputDialog dialog=new MultipleInputDialog(getShell(),Messages.LuaEnvironmentTabNewVariableDialogTitle);
  dialog.addTextField(NAME_LABEL,null,false);
  dialog.addVariablesField(VALUE_LABEL,null,true);
  if (dialog.open() != Window.OK) {
    return;
  }
  final String name=dialog.getStringValue(NAME_LABEL);
  final String value=dialog.getStringValue(VALUE_LABEL);
  addVariable(new EnvironmentVariable(name.trim(),value.trim()));
  updateAppendReplace();
}
 

Example 33

From project libra, under directory /plugins/org.eclipse.libra.framework.equinox.ui/src/org/eclipse/libra/framework/equinox/ui/internal/.

Source file: JavaProfileEditorSection.java

  19 
vote

protected void handleEdit(){
  try {
    if (frameworkInstance != null && frameworkInstance.getFrameworkInstanceConfiguration() != null) {
      ITargetDefinition original=frameworkInstance.getFrameworkInstanceConfiguration().getTargetDefinition();
      EditTargetDefinitionWizard wizard=new EditTargetDefinitionWizard(original,true);
      wizard.setWindowTitle(Messages.configurationEditorTargetDefinitionTitle);
      WizardDialog dialog=new WizardDialog(this.getShell(),wizard);
      if (dialog.open() == Window.OK) {
        ITargetDefinition newTarget=wizard.getTargetDefinition();
        frameworkInstance.getFrameworkInstanceConfiguration().setTargetDefinition(newTarget);
        ITargetPlatformService service=TargetDefinitionUtil.getTargetPlatformService();
        service.saveTargetDefinition(newTarget);
      }
    }
  }
 catch (  CoreException e) {
    Trace.trace(Trace.SEVERE,"failed to update target platform definition");
  }
}
 

Example 34

From project logsaw-app, under directory /net.sf.logsaw.ui/src/net/sf/logsaw/ui/commands/handlers/.

Source file: AddLogResourceHandler.java

  19 
vote

@Override public Object execute(ExecutionEvent event) throws ExecutionException {
  IWorkbenchWindow window=HandlerUtil.getActiveWorkbenchWindow(event);
  IWorkbenchPage page=window.getActivePage();
  IViewPart view=page.findView(LogResourcesView.ID);
  Collection<ILogDialectFactory> dialectFactories=null;
  try {
    dialectFactories=CorePlugin.getDefault().getLogDialectFactories();
  }
 catch (  CoreException e) {
    UIPlugin.logAndShowError(e,false);
    return null;
  }
  if (dialectFactories.isEmpty()) {
    StatusManager.getManager().handle(new Status(IStatus.ERROR,UIPlugin.PLUGIN_ID,Messages.AddLogResourceAction_noLogDialects),StatusManager.SHOW);
    return null;
  }
  String filename=event.getParameter("net.sf.logsaw.ui.commands.AddLogResourceCommand.filename");
  WizardDialog wiz=new WizardDialog(Display.getDefault().getActiveShell(),new AddLogResourceWizard(dialectFactories,filename));
  wiz.setHelpAvailable(true);
  if (wiz.open() == Window.OK) {
    IRefreshablePart refresh=view != null ? (IRefreshablePart)view.getAdapter(IRefreshablePart.class) : null;
    if (refresh != null) {
      refresh.refresh();
    }
  }
  return null;
}
 

Example 35

From project m2eclipse-cvs, under directory /org.sonatype.m2e.cvs/src/org/sonatype/m2e/cvs/internal/.

Source file: TeamCvsHandlerUi.java

  19 
vote

public ScmUrl selectUrl(Shell shell,ScmUrl scmUrl){
  TeamCvsRepositorySelectionWizard wizard=new TeamCvsRepositorySelectionWizard();
  WizardDialog dialog=new WizardDialog(shell,wizard);
  if (dialog.open() == Window.OK) {
    return TeamCvsUtil.getScmUrl(wizard.getSelectedModule());
  }
  return null;
}
 

Example 36

From project m2eclipse-webby, under directory /org.sonatype.m2e.webby/src/org/sonatype/m2e/webby/internal/launch/ui/.

Source file: WebbyTab.java

  19 
vote

private IJavaProject chooseJavaProject(){
  ILabelProvider labelProvider=new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
  ElementListSelectionDialog dialog=new ElementListSelectionDialog(getShell(),labelProvider);
  dialog.setTitle(LauncherMessages.AbstractJavaMainTab_4);
  dialog.setMessage(LauncherMessages.AbstractJavaMainTab_3);
  try {
    dialog.setElements(JavaCore.create(getWorkspaceRoot()).getJavaProjects());
  }
 catch (  JavaModelException jme) {
    WebbyPlugin.log(jme);
  }
  IJavaProject javaProject=getJavaProject();
  if (javaProject != null) {
    dialog.setInitialSelections(new Object[]{javaProject});
  }
  if (dialog.open() == Window.OK) {
    return (IJavaProject)dialog.getFirstResult();
  }
  return null;
}
 

Example 37

From project makegood, under directory /com.piece_framework.makegood.ui/src/com/piece_framework/makegood/ui/preferences/.

Source file: MakeGoodPropertyPage.java

  19 
vote

@Override public void widgetSelected(SelectionEvent e){
  ElementTreeSelectionDialog dialog=new ElementTreeSelectionDialog(contents.getShell(),new WorkbenchLabelProvider(),new WorkbenchContentProvider());
  dialog.setTitle(dialogTitle);
  dialog.setMessage(dialogMessage);
  dialog.setAllowMultiple(false);
  dialog.setComparator(new ViewerComparator(){
    @Override public int compare(    Viewer viewer,    Object e1,    Object e2){
      if (e1 instanceof IFile && e2 instanceof IFolder) {
        return 1;
      }
 else       if (e1 instanceof IFolder && e2 instanceof IFile) {
        return -1;
      }
      return super.compare(viewer,e1,e2);
    }
  }
);
  dialog.addFilter(viewerFilter);
  dialog.setInput(getProject());
  if (dialog.open() == Window.OK && dialog.getFirstResult() != null) {
    String text="";
    Object selectedResource=dialog.getFirstResult();
    if (selectedResource != null) {
      if ((selectedResource instanceof IFile) && (allowedResource & SELECTION_ALLOW_FILE) == SELECTION_ALLOW_FILE) {
        text=((IFile)selectedResource).getFullPath().toString();
      }
 else       if ((selectedResource instanceof IFolder) && (allowedResource & SELECTION_ALLOW_FOLDER) == SELECTION_ALLOW_FOLDER) {
        text=((IFolder)selectedResource).getFullPath().toString();
      }
    }
    subject.setText(text);
  }
}
 

Example 38

From project mwe, under directory /plugins/org.eclipse.emf.mwe.ui/src/org/eclipse/emf/mwe/internal/ui/debug/launching/ui/.

Source file: MWELaunchConfigMainTab.java

  19 
vote

private void handleWfButtonSelected(){
  ResourceListSelectionDialog dialog=new ResourceListSelectionDialog(getShell(),getWorkspaceRoot(),IResource.FILE);
  dialog.setTitle(Messages.MWELaunchConfigMainTab_WorkflowSelectDlgTitle);
  dialog.setMessage(Messages.MWELaunchConfigMainTab_WorkflowSelectDlgMessage);
  if (dialog.open() == Window.OK) {
    Object[] files=dialog.getResult();
    IFile file=(IFile)files[0];
    setWfText(file.getFullPath().toString());
  }
}
 

Example 39

From project mylyn.builds, under directory /org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/actions/.

Source file: RunBuildAction.java

  19 
vote

public static void askParametersAndRunBuild(final IBuildPlan plan){
  BuildPlan copy=((BuildPlan)plan).createWorkingCopy();
  Map<String,String> parameters=null;
  if (!copy.getParameterDefinitions().isEmpty()) {
    ParametersDialog dialog=new ParametersDialog(WorkbenchUtil.getShell(),copy);
    if (dialog.open() != Window.OK) {
      return;
    }
    parameters=dialog.getParameters();
  }
  RunBuildRequest request=new RunBuildRequest(copy);
  request.setParameters(parameters);
  RunBuildOperation operation=BuildsUiInternal.getFactory().getRunBuildOperation(request);
  operation.addOperationChangeListener(new OperationChangeListener(){
    @Override public void done(    OperationChangeEvent event){
      if (event.getStatus().isOK()) {
        Display.getDefault().asyncExec(new Runnable(){
          public void run(){
            BuildsUiInternal.getFactory().getRefreshOperation(plan).execute();
          }
        }
);
      }
    }
  }
);
  operation.execute();
}
 

Example 40

From project mylyn.context, under directory /org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/preferences/.

Source file: FocusedResourcesPreferencePage.java

  19 
vote

private void addIgnore(){
  InputDialog dialog=new InputDialog(getShell(),Messages.FocusedResourcesPreferencePage_Add__IGNORED_RESOURCE,Messages.FocusedResourcesPreferencePage_Enter_pattern_____any_string_,null,null);
  dialog.open();
  if (dialog.getReturnCode() != Window.OK) {
    return;
  }
  String pattern=dialog.getValue();
  if (pattern.equals("")) {
    return;
  }
  TableItem item=new TableItem(ignoreTable,SWT.NONE);
  item.setText(pattern);
  item.setChecked(true);
}
 

Example 41

From project mylyn.docs.intent.main, under directory /plugins/org.eclipse.mylyn.docs.intent.exporter.ui/src/org/eclipse/mylyn/docs/intent/exporter/ui/popup/actions/.

Source file: ExportIntentDocumentationAction.java

  19 
vote

/** 
 * {@inheritDoc}
 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
 */
public Object execute(ExecutionEvent event) throws ExecutionException {
  ISelection selection=HandlerUtil.getCurrentSelection(event);
  if (selection instanceof StructuredSelection) {
    IProject intentProject=null;
    if (((StructuredSelection)selection).getFirstElement() instanceof IProject) {
      intentProject=(IProject)((StructuredSelection)selection).getFirstElement();
    }
 else     if (((StructuredSelection)selection).getFirstElement() instanceof IntentDocument) {
    }
    ExportOptionsDialog exportOptionsDialog=new ExportOptionsDialog(Display.getCurrent().getActiveShell(),new File(((IProject)intentProject).getLocationURI()).getAbsolutePath() + "/html");
    if (Window.OK == exportOptionsDialog.open()) {
      exportIntentDocumentation((IProject)intentProject,exportOptionsDialog.getTargetFolderLocation(),exportOptionsDialog.getExportedIntentDocumentName(),new BasicMonitor());
    }
  }
  return null;
}
 

Example 42

From project mylyn.incubator, under directory /org.eclipse.mylyn.sandbox.tests/src/org/eclipse/mylyn/monitor/tests/.

Source file: MultiWindowMonitorTest.java

  19 
vote

private int getNewWindowNumber(){
  Window[] windows=parentManager.getWindows();
  int count=windows.length;
  boolean checkArray[]=new boolean[count];
  for (int nX=0; nX < count; nX++) {
    if (windows[nX] instanceof WorkbenchWindow) {
      WorkbenchWindow ww=(WorkbenchWindow)windows[nX];
      int index=ww.getNumber() - 1;
      if (index >= 0 && index < count) {
        checkArray[index]=true;
      }
    }
  }
  for (int index=0; index < count; index++) {
    if (!checkArray[index]) {
      return index + 1;
    }
  }
  return count + 1;
}
 

Example 43

From project netifera, under directory /platform/com.netifera.platform.host/com.netifera.platform.host.terminal.ui/src/com/netifera/platform/host/terminal/ui/view/.

Source file: TerminalView.java

  19 
vote

private ITerminalConnector showSettingsDialog(String title){
  ITerminalConnector[] connectors=terminalViewControl.getConnectors();
  if (terminalViewControl.getState() != TerminalState.CLOSED)   connectors=new ITerminalConnector[0];
  ITerminalConnector c=loadSettings(new LayeredSettingsStore(fStore,getPreferenceSettingsStore()),connectors);
  if (terminalViewControl.getTerminalConnector() != null)   c=terminalViewControl.getTerminalConnector();
  TerminalSettingsDialog dlgTerminalSettings=new TerminalSettingsDialog(getViewSite().getShell(),connectors,c);
  dlgTerminalSettings.setTerminalTitle(getActiveConnection().getPartName());
  if (title != null)   dlgTerminalSettings.setTitle(title);
  Logger.log("opening Settings dialog.");
  if (dlgTerminalSettings.open() == Window.CANCEL) {
    Logger.log("Settings dialog cancelled.");
    return null;
  }
  Logger.log("Settings dialog OK'ed.");
  saveSettings(fStore,dlgTerminalSettings.getConnector());
  saveSettings(getPreferenceSettingsStore(),dlgTerminalSettings.getConnector());
  setViewTitle(dlgTerminalSettings.getTerminalTitle());
  return dlgTerminalSettings.getConnector();
}
 

Example 44

From project Newsreader, under directory /bundles/org.eclipse.ecf.salvo.ui/src/org/eclipse/ecf/salvo/ui/internal/handlers/.

Source file: UnsubscribeHandler.java

  19 
vote

public Object execute(ExecutionEvent event) throws ExecutionException {
  ISelection selection=HandlerUtil.getCurrentSelection(event);
  if (selection instanceof IStructuredSelection) {
    for (    Object selo : ((IStructuredSelection)selection).toArray()) {
      if (selo instanceof ISalvoResource) {
        Object object=((ISalvoResource)selo).getObject();
        if (object instanceof IServer) {
          MessageDialogWithToggle x=MessageDialogWithToggle.openInformation(HandlerUtil.getActiveShell(event),((IServer)object).getAddress(),"Do you want to unsubscribe from server " + ((IServer)object).getAddress() + "?","Delete resource contents on disk? (cannot be undone)",false,null,null);
          if (x.getReturnCode() == Window.OK) {
            try {
              ServerStoreFactory.instance().getServerStoreFacade().unsubscribeServer((IServer)object,x.getToggleState());
            }
 catch (            StoreException e) {
              throw new ExecutionException(e.getMessage(),e);
            }
          }
        }
 else         if (object instanceof INewsgroup) {
          boolean x=MessageDialog.openConfirm(HandlerUtil.getActiveShell(event),((INewsgroup)object).getNewsgroupName(),"Do you want to unsubscribe from group " + ((INewsgroup)object).getNewsgroupName() + "?");
          if (x) {
            try {
              ServerStoreFactory.instance().getServerStoreFacade().unsubscribeNewsgroup((INewsgroup)object,false);
            }
 catch (            StoreException e) {
              throw new ExecutionException(e.getMessage(),e);
            }
          }
        }
      }
    }
  }
  return null;
}
 

Example 45

From project org.openscada.orilla, under directory /org.openscada.ae.ui.views/src/org/openscada/ae/ui/views/dialog/.

Source file: EventHistorySearchDialog.java

  19 
vote

@Override public boolean close(){
  if (getReturnCode() != Window.OK) {
    this.filter=null;
  }
  return super.close();
}
 

Example 46

From project org.ops4j.pax.runner, under directory /pax-runner-eclipse/pax-runner-eclipse-ui/src/main/java/org/ops4j/pax/cursor/ui/.

Source file: ProvisionBlock.java

  19 
vote

/** 
 * Handles add button push.
 */
protected void onAddButtonSelected(){
  InputDialog dialog=new InputDialog(getShell(),"Add bundle from URL","Bundle URL (e.g. OBR):",null,null);
  if (dialog.open() != Window.OK) {
    return;
  }
  addURL(dialog.getValue());
}
 

Example 47

From project phing-eclipse, under directory /org.ganoro.phing.ui/src/org/ganoro/phing/ui/internal/preferences/.

Source file: AntPropertiesBlock.java

  19 
vote

private void addPropertyFile(){
  String title=AntPreferencesMessages.AntPropertiesFileSelectionDialog_12;
  String message=AntPreferencesMessages.AntPropertiesFileSelectionDialog_13;
  String filterExtension="properties";
  String filterMessage=AntPreferencesMessages.AntPropertiesFileSelectionDialog_14;
  Object[] existingFiles=getPropertyFiles();
  List propFiles=new ArrayList(existingFiles.length);
  for (int j=0; j < existingFiles.length; j++) {
    String file=(String)existingFiles[j];
    try {
      propFiles.add(AntUtil.getFileForLocation(VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(file),null));
    }
 catch (    CoreException e) {
      PhingUi.log(e.getStatus());
    }
  }
  FileSelectionDialog dialog=new FileSelectionDialog(propertyTableViewer.getControl().getShell(),propFiles,title,message,filterExtension,filterMessage);
  if (dialog.open() == Window.OK) {
    Object[] elements=dialog.getResult();
    for (int i=0; i < elements.length; i++) {
      IFile file=(IFile)elements[i];
      String varExpression=VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc",file.getFullPath().toString());
      ((AntContentProvider)fileTableViewer.getContentProvider()).add(varExpression);
    }
    container.update();
  }
}
 

Example 48

From project radrails, under directory /plugins/com.aptana.radrails.rcp/src/com/aptana/radrails/rcp/.

Source file: IDEWorkbenchAdvisor.java

  19 
vote

/** 
 * Initialize the listener for settings changes.
 */
private void initializeSettingsChangeListener(){
  settingsChangeListener=new Listener(){
    boolean currentHighContrast=Display.getCurrent().getHighContrast();
    public void handleEvent(    org.eclipse.swt.widgets.Event event){
      if (Display.getCurrent().getHighContrast() == currentHighContrast)       return;
      currentHighContrast=!currentHighContrast;
      if (new MessageDialog(null,IDEWorkbenchMessages.SystemSettingsChange_title,null,IDEWorkbenchMessages.SystemSettingsChange_message,MessageDialog.QUESTION,new String[]{IDEWorkbenchMessages.SystemSettingsChange_yes,IDEWorkbenchMessages.SystemSettingsChange_no},1).open() == Window.OK) {
        PlatformUI.getWorkbench().restart();
      }
    }
  }
;
}