Examples of MPart


Examples of org.eclipse.e4.ui.model.application.ui.basic.MPart

    {
        NewClientWizard wizard = new NewClientWizard();
        WizardDialog dialog = new WizardDialog(shell, wizard);
        if (dialog.open() == Window.OK)
        {
            MPart part = partService.createPart(UIConstants.Part.PORTFOLIO);
            part.setLabel(Messages.LabelUnnamedXml);
            part.getTransientData().put(Client.class.getName(), wizard.getClient());

            MPartStack stack = (MPartStack) modelService.find(UIConstants.PartStack.MAIN, app);
            stack.getChildren().add(part);

            partService.showPart(part, PartState.ACTIVATE);
View Full Code Here

Examples of org.eclipse.e4.ui.model.application.ui.basic.MPart

            MessageDialog.openError(shell, Messages.LabelError,
                            MessageFormat.format(Messages.MsgErrorOpeningFile, logfile.getAbsoluteFile()));
        }
        else
        {
            MPart part = partService.createPart(UIConstants.Part.TEXT_VIEWER);
            part.getPersistedState().put(UIConstants.Parameter.FILE, logfile.getAbsolutePath());

            MPartStack stack = (MPartStack) modelService.find(UIConstants.PartStack.MAIN, app);
            stack.getChildren().add(part);

            partService.showPart(part, PartState.ACTIVATE);
View Full Code Here

Examples of org.eclipse.e4.ui.model.application.ui.basic.MPart

        dialog.setFilterNames(new String[] { Messages.LabelPortfolioPerformanceFile });
        String fileSelected = dialog.open();

        if (fileSelected != null)
        {
            MPart part = partService.createPart(UIConstants.Part.PORTFOLIO);
            part.setLabel(new File(fileSelected).getName());
            part.setTooltip(fileSelected);
            part.getPersistedState().put(UIConstants.Parameter.FILE, fileSelected);

            MPartStack stack = (MPartStack) modelService.find(UIConstants.PartStack.MAIN, app);
            stack.getChildren().add(part);

            partService.showPart(part, PartState.ACTIVATE);
View Full Code Here

Examples of org.eclipse.e4.ui.model.application.ui.basic.MPart

public class OpenPartHandler
{
    @Execute
    public void execute(EPartService partService, @Named(UIConstants.Parameter.PART) String partname)
    {
        MPart part = partService.findPart(partname);
        part.setVisible(true);
        partService.activate(part, true);
    }
View Full Code Here

Examples of org.eclipse.e4.ui.model.application.ui.basic.MPart

                        sync.asyncExec(new Runnable()
                        {
                            @Override
                            public void run()
                            {
                                MPart part = partService.createPart(UIConstants.Part.PORTFOLIO);
                                part.setLabel(sampleFile.substring(sampleFile.lastIndexOf('/') + 1));
                                part.getTransientData().put(Client.class.getName(), client);

                                MPartStack stack = (MPartStack) modelService.find(UIConstants.PartStack.MAIN, app);
                                stack.getChildren().add(part);

                                partService.showPart(part, PartState.ACTIVATE);
View Full Code Here

Examples of org.eclipse.e4.ui.model.application.ui.basic.MPart

    private static final class PartLabelProvider extends LabelProvider
    {
        @Override
        public String getText(Object element)
        {
            MPart part = (MPart) element;
            String tooltip = part.getTooltip();
            return tooltip != null ? part.getLabel() + " (" + part.getTooltip() + ")" : part.getLabel(); //$NON-NLS-1$ //$NON-NLS-2$
        }
View Full Code Here

Examples of org.eclipse.e4.ui.model.application.ui.basic.MPart

            return;
          }
        }
      }
     
      MPart p = MBasicFactory.INSTANCE.createPart();
      p.setLabel(m.getName());
      if( m.getType() == MediaType.MOVIE ) {
        p.setIconURI("platform:/plugin/at.bestsolution.efxclipse.runtime.examples.media/icons/22/kaffeine.png")
      } else if( m.getType() == MediaType.PICTURE ) {
        p.setIconURI("platform:/plugin/at.bestsolution.efxclipse.runtime.examples.media/icons/22/games-config-background.png");
      } else {
        p.setIconURI("platform:/plugin/at.bestsolution.efxclipse.runtime.examples.media/icons/22/player-volume.png");
      }
     
      p.setContributionURI("bundleclass://at.bestsolution.efxclipse.runtime.examples.media/at.bestsolution.efxclipse.runtime.examples.media.parts.MediaPart");
      p.getPersistedState().put(MediaPart.MEDIA_OBJECT_KEY, instance);
      stack.getChildren().add(p);
      partService.activate(p,true);     
    }
  }
View Full Code Here

Examples of org.eclipse.e4.ui.model.application.ui.basic.MPart

       
        Button b = new Button("Toggle Rendering");
        b.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            MPart part = dd.getSelectionModel().getSelectedItem();
            part.setToBeRendered(!part.isToBeRendered());
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      {
        HBox hbox = new HBox(10);
       
        final ComboBox<MPart> dd = new ComboBox<>();
        dd.setCellFactory(new Callback<ListView<MPart>, ListCell<MPart>>() {
         
          @Override
          public ListCell<MPart> call(ListView<MPart> param) {
            return new ListCell<MPart>() {
              @Override
              protected void updateItem(MPart item, boolean empty) {
                super.updateItem(item, empty);
                if( item != null ) {
                  setText(item.getLocalizedLabel());
                }
              }
            };
          }
        });
        dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MPart.class, null)));
        hbox.getChildren().add(dd);
       
        Button b = new Button("Toggle Visibile");
        b.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            MPart part = dd.getSelectionModel().getSelectedItem();
            part.setVisible(!part.isVisible());
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      {
        HBox hbox = new HBox(10);
       
        final ComboBox<MElementContainer> dd = new ComboBox<>();
        dd.setCellFactory(new Callback<ListView<MElementContainer>, ListCell<MElementContainer>>() {
         
          @Override
          public ListCell<MElementContainer> call(ListView<MElementContainer> param) {
            return new ListCell<MElementContainer>() {
              @Override
              protected void updateItem(MElementContainer item, boolean empty) {
                super.updateItem(item, empty);
                if( item != null ) {
                  setText(item.getClass().getSimpleName())
                }
              }
            };
          }
        });
        dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MElementContainer.class, null)));
        hbox.getChildren().add(dd);
       
        Button b = new Button("Add new Part");
        b.setOnAction(new EventHandler<ActionEvent>() {
          @SuppressWarnings("unchecked")
          @Override
          public void handle(ActionEvent event) {
            MElementContainer container = dd.getSelectionModel().getSelectedItem();
           
            MPart p = BasicFactoryImpl.eINSTANCE.createPart();
            p.setLabel("New Part");
            p.setContributionURI("bundleclass://at.bestsolution.efxclipse.testcases.e4/at.bestsolution.efxclipse.testcases.e4.parts.ContentPanel");
            container.getChildren().add(p);
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      {
        HBox hbox = new HBox(10);
       
        final ComboBox<MElementContainer> dd = new ComboBox<>();
        dd.setCellFactory(new Callback<ListView<MElementContainer>, ListCell<MElementContainer>>() {
         
          @Override
          public ListCell<MElementContainer> call(ListView<MElementContainer> param) {
            return new ListCell<MElementContainer>() {
              @Override
              protected void updateItem(MElementContainer item, boolean empty) {
                super.updateItem(item, empty);
                if( item != null ) {
                  setText(item.getClass().getSimpleName())
                }
              }
            };
          }
        });
        dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MElementContainer.class, null)));
        hbox.getChildren().add(dd);
       
        Button b = new Button("Remove last Part");
        b.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            MElementContainer container = dd.getSelectionModel().getSelectedItem();
            container.getChildren().remove(container.getChildren().size()-1);
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      {
        HBox hbox = new HBox(10);
       
        final ComboBox<MElementContainer> dd = new ComboBox<>();
        dd.setCellFactory(new Callback<ListView<MElementContainer>, ListCell<MElementContainer>>() {
         
          @Override
          public ListCell<MElementContainer> call(ListView<MElementContainer> param) {
            return new ListCell<MElementContainer>() {
              @Override
              protected void updateItem(MElementContainer item, boolean empty) {
                super.updateItem(item, empty);
                if( item != null ) {
                  setText(item.getClass().getSimpleName())
                }
              }
            };
          }
        });
        dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MElementContainer.class, null)));
        hbox.getChildren().add(dd);
       
        Button b = new Button("Move last Part");
        b.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            MElementContainer container = dd.getSelectionModel().getSelectedItem();
            Object o = container.getChildren().remove(container.getChildren().size()-1);
            container.getChildren().add(container.getChildren().size()-1, o);
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      {
        HBox hbox = new HBox(10);
       
        final ComboBox<MPart> dd = new ComboBox<>();
        dd.setCellFactory(new Callback<ListView<MPart>, ListCell<MPart>>() {
         
          @Override
          public ListCell<MPart> call(ListView<MPart> param) {
            return new ListCell<MPart>() {
              @Override
              protected void updateItem(MPart item, boolean empty) {
                super.updateItem(item, empty);
                if( item != null ) {
                  setText(item.getLocalizedLabel());
                }
              }
            };
          }
        });
        dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MPart.class, null)));
        hbox.getChildren().add(dd);
       
        Button b = new Button("Detach");
        b.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            MPart part = dd.getSelectionModel().getSelectedItem();
            modelService.detach(part, 0, 0, 300, 300);
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
View Full Code Here

Examples of org.eclipse.e4.ui.model.application.ui.basic.MPart

    // TODO Should we do the traversal before???
    showElementRecursive(newElement);
  }

  boolean handleStackItemClose(MStackElement e, WStackItem<I, IC> item) {
    MPart part = getPart(e);
    if( ! part.isCloseable() ) {
      return false;
    }
   
    IEclipseContext partContext = part.getContext();
    IEclipseContext parentContext = getContextForParent(part);
    // a part may not have a context if it hasn't been rendered
    IEclipseContext context = partContext == null ? parentContext : partContext;
    // Allow closes to be 'canceled'
    EPartService partService = (EPartService) context
View Full Code Here

Examples of org.eclipse.e4.ui.model.application.ui.basic.MPart

    }
   
    // Last reference removed so we can destroy it
    if( set.isEmpty() ) {
      if (refElement instanceof MPart) {
        MPart thePart = (MPart) refElement;
        String imageURI = thePart.getIconURI();
        thePart.setIconURI(null);
        thePart.setIconURI(imageURI);
      }
      getPresentationEngine().removeGui(refElement);
    } else {
      IEclipseContext curContext = modelService.getContainingContext(element);
      MPlaceholder currentRef = refElement.getCurSharedRef();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.